Categories
Critters Writing

A Tale of 2 Monsters Part 1: From the Legends

Recovered from the Wayback Machine.

Who is there that doesn’t love a monster?

What is a monster? One could say it is any creature bent on damage or destruction. This definition would then force us to include people in the category of “monster”.

However, when I think of “monsters” I think of the creatures of legends and tales, from the books and movies, and I think of the creatures that have entertained me for years. A definition of “monster” that I particularly like is from Webster’s Revised Unabridged Dictionary1:

Something of unnatural size, shape, or quality; a prodigy; an enormity; a marvel.

A marvel. That fits so well. We marvel at the unknown, we marvel at what may be around the door, under the water, out in space. With this definition, instead of a monster being something to fear, it becomes something that is really… marvelous.

This four-part Dynamic Earth article covers two famous monsters, the Loch Ness Monster and the giant squid: one creature known to be real, the other considered more myth than monster, depending on who you talk to.

Part One of the article focuses on what makes a monster, including an overview on what makes a legend, such as the tale of the great kraken, half octopus and half crab and large enough to destroy ships. Part Two then takes us from the realm of folklore to the realm of science, and discusses the controversial study of cryptozoology: the field of study devoted to investigating the possibility of the existence of animals from legends and folk lore.

Parts Three and Four then concentrate on the two stars of the article: the Loch Ness Monster and the giant squid. Both true marvels. Both true monsters.

The Monsters

Though covered in more detail in parts three and four of this article, I did want to talk briefly about Nessie and the giant squid, specifically as they relate to our topic of legends and legendary beasts.

The giant squid could originally be termed a cryptid — an animal based purely in legends and folk tales — but scientists now have physical evidence of these creatures, including entire specimens. Based on this, one would assume that the giant squid now fits comfortably within the more traditional sciences such as zoology and marine biology.

However, there is still much about giant squids that is unknown, including the size they can reach. General supposition is that the giant squid reaches up to 60 feet in length, weighing in within the 1-2 ton range. Nevertheless, eyewitness accounts of the giant squid have put it at sizes longer than 100 feet! Not only that, but the behavior of the giant squid is also based more in rumor and in legend than in scientific observation, with stories of these creatures attacking people in the water, as well as attacking whales and boats. Because little is known about squid behavior outside of these legends, the giant squid still maintains a foot, or should I say tentacle within the field of cryptozoology.

Studies of the Loch Ness Monster — or Nessie as it is affectionately termed — live solely in the realm of cryptozoology as there is no actual physical evidence of Nessie outside of some highly contested radar and other images in addition to eyewitness accounts. However, the eyewitness accounts of Nessie are numerous, the tales of Nessie have been told for years, and there is no direct physical evidence that Nessie does not exist. So the creature lives firmly entrenched in cryptozoology and not mythology as some would feel to be more appropriate.

Both Nessie and the giant squid are monsters in the truest sense. Both are large, much larger than people, both inhabit the world of water which is still foreign to most of us, and both are heroes of tales from throughout the centuries.

Tales of Monsters

We love to be frightened. We love scary movies, and ghost stories, and legends about evil beings, and movies with big monsters and aliens and other things that go bump in the night. Or day for that matter.

Does the best selling author of our time write books about romance or suburban angst? No, the best selling author is Stephen King, whose genre tends to be focused on horror. Is the favorite ride at an amusement park the merry-go-round? No, the favorite ride is most likely the roller coaster — the bigger, faster, higher, and the scarier, the better.

So, what scares us most of all? At least in that pleasant, shivery way we all seem to crave?

If you’re thinking a person wearing a mask, carrying an axe dripping with gore, you forget that I mentioned “pleasant, shivery”, not “grossed out and tense”. No, for the fun type of scare only one thing will do, and that thing is monsters. Preferably big ones that don’t stay in their own habitat but leave the water (ice, sky, ground, space) and come stomping with big oversize feet right at you. Well, not at you specifically, but the hero of the movie or book or story you are currently enjoying, the person who we can identify with because we are so caught up in said book, movie, or story.

How odd that we are frightened of these large creatures when we should be more frightened of the smallest creatures inhabiting the earth. After all, more of us die from disease and sickness caused by insects, bacteria, viruses, and mutated cells than from any other reason.

Very few people die from being *squished* by a large creature ala Godzilla.

Monsters have scared and entertained humanity since we first started drawing pictures of them on cave walls and telling stories about them around campfires. We liked stories of monsters so much, we even created legends about some of them, legends that survive to this day.

The thing about monsters, though, is they are best savored behind a curtain of ignorance. Once a monster is viewed up close, and looked at with the looking glass we call reason, it no longer has the power to scare us and we wonder that it ever did.

Imagine for a moment that you are an ancient sailor, sailing in a small boat about 20 feet or so in length. All of a sudden next to you appears this large behemoth of a creature, of a size that could make splinters of your boat and most likely of yourself.

The behemoth is a whale, a gray whale to be exact. Are you frightened? I’m asking the modern you this question. How can you be frightened of something that you might pay a ton of money to go see in boats as small or even smaller. But to that sailor of long ago — that’s you, too, remember — the whale must seem as a monster sent by the gods themselves to drag you to a watery death.

So you pray to the gods and you ask for salvation and forgiveness from whatever evil you had done to be sent such punishment. Lo and behold, the behemoth slowly moves away! You in this modern day and age know that the whale has moved away because you a) aren’t food, b) aren’t an enemy (yet), and c) aren’t very interesting. But to you the sailor of the past, you know in your heart of hearts that you have been saved by divine intervention.

You also know that you have a real kicker of a story to tell when you get into shore, and a legend is born.

How Legends Begin

What makes a legend? In the previous section we can see how legends are born whenever we are confronted by something outside our experience. However, there are other factors that go into making a legend.

First, many of our earlier events in history were not originally recorded in writing, but were, instead, told verbally, as stories. Sometimes accuracy was maintained…and sometimes the story teller embellished the telling, making the story more interesting to the audience or perhaps more flattering to the story’s subject.

For instance, Alexander the Great was a real person, a key figure in history. We know this is true. However, there are an enormous number of legends about Alexander, of which my favorite is the legend of the Gordian Knot.

The legend of the Gordian Knot is that there existed in the town of Gorium, in the ancient land of Phrygians, an ox cart tied to a post with a knot so complex, with both ends of the knot hidden, that no one person could untie it. Legend also has it that it was foretold that whoever would loose the knot would be conqueror of Asia.

Alexander the Great heard of the legend and decided to take a hand at undoing the Gordian Knot. After looking at it he takes his sword out and cuts it in two, thereby “loosing” the knot with one simple, clean cut. To this day coming up with a simple, clean solution to a supposedly complex and unsolvable problem is known as “cutting the Gordian Knot”.

Alexander the Great was taught by another well-known person of his time: Aristotle. One can’t help wondering what the teacher would have thought of the student’s solution. Would he have admired the innovative approach? Or would he have deplored the loss of a perfectly good rope.

Is the story true? Possibly. Or the story could have been fabricated as a form of propaganda from Alexander in order to provide popular justification for his aggressive tendencies. Regardless of its truth or not, the legend of the Gordian Knot remains to this day.

Another factor in the making of a legend is that humanity has never been especially graceful about admitting a lack of knowledge when faced with a new unknown, and can sometimes come up with the most outrageous explanations of an event or object.

As an example of dealing with an unknown, our earlier ancestors didn’t always have an understanding of planetary orbits, so an eclipse of the sun didn’t occur because the moon’s orbit brought it between the earth and the sun, blocking the view of the sun. No, the eclipse occurred because dragons were eating the sun. To stop these hungry reptiles, these same ancestors pounded on kettles and pots, making noise to chase the monsters away. If you think this is silly, think on this: the noise making worked and the sun did re-appear. Our ancestors may not have understood planetary orbits, but they did understand cause and effect.

The reason why our ancestors assumed dragons were eating the sun, or that gods controlled the weather and the seas is that they knew little about the world around them. Folks in the past didn’t understand that forces deep within the earth were responsible for earthquakes and volcanoes, and that weather was influenced by something such as the temperature of the ocean waters. To them, it would seem as if some external force was responsible for all unexplained events.

Consider some poor sailor in one of the small sailing craft that plied the sea centuries ago. The boat is moving along nicely and passing to one side of an island when all of a sudden, the island seems to be much closer than originally thought. Not only that, but huge teeth and arms seem to be reaching out of the water, grabbing the boat and dashing it into a million pieces.

We understand about things such as currents and lower tides exposing rocky shores, but our earlier ancestors may not have been as aware of such things. To them, it would look as if the island or sea was alive and a monster has suddenly grabbed the boat to tear it apart. If at least one seaman escapes with his life and tells this tale, he plants the idea in other seaman minds and a legend begins to form. Sound silly? Well, the legend of the creature as large as an island is real and the creature is known as the Kraken.

 

The Kraken

 

His ancient, dreamless, uninvaded sleep,The Kraken sleepeth
 

So goes a poem by Lord Tennyson titled The Kraken.

Depending on the source you read, the Kraken is fabled to be the last of the Titans as well as a Norwegian sea monster. It is described as having a thousand tentacles and being a cross somewhere between a crab and an octopus, but on a much larger scale.

The Museum of Natural Mystery 5 includes a reference to an earlier written description provided by a 16th century Norwegian Bishop. This description states that the Kraken is a “floating island”, over 1 1/2 miles wide! Now that would be a monster to see.

Later tales of the Kraken have shrunk the creature down to a more palatable size, but still maintained its ferocity and stories about the creature attacking ships, sometimes pulling the ships under water, have continued even into the 20th century.

Conjecture at this time is that the Kraken may actually have been a giant squid. If this seems farfetched consider that rumors exist that the giant squid can reach lengths of 100 feet or more. If so, a squid this size, weighing a couple of tons, could easily capsize a smaller sailing vessel. Even a squid 60 feet in length, the largest scientifically proven size, would not be something one would want to meet while going for a swim in the moonlight.

The Kraken has all the makings of a truly great monster. It’s large, it lives in the ocean, in the deepest parts of the ocean, and legends say that it has attacked people. Tales of these attacks aren’t frequent enough to become truly intimidating, just enough to give us that pleasant, shivery sensation.

Now if the legends of the Kraken are attributable to the giant squid, we haven’t lost anything in the exposure. So little is known about these creatures that they might as well exist in legend as outside of it. In fact, we are so attracted to the legends about the giant squid that we have made it a star. Or should we say that Jules Verne has made it a star in his classic tale 20,000 Leagues Under the Sea. And it is tales such as Verne’s and movies based on these tales that keep legends of monsters of the deep alive today.

Modern Day Legends: The Movies

Considering what was said earlier, that legends sometimes grow out of humanity’s ignorance as well as our fear of the unknown and you can see the basis of many of the old science fiction movies of the 50s. Two common themes dominate these movies: the first is our fear of The Bomb; the second was our fear of what exists in regions hostile to man — the sea and space.

Interest in science grew enormously in the 50’s, especially interest in outer space. The race was on to put the first man into space and we all dreamed of a time when we, humanity, would ride large ships to other stars, preferably uninhabited stars. And that was the contradiction of the times — as much as we wanted to explore the unknown, we were also afraid of what we would find.

So, we had movies such as the extremely well done War of the Worlds6 and the not so well done Plan 9 from Outer Space7. It is a wonder we could sleep at night, our movies had creatures from every corner of the galaxy ready to fly in and wipe us all out.

Even the plants were dangerous.

If you are a serious fan of science fiction then you also had to have seen the original Thing8, with a pre-Gunsmoke James Arness appearing as plant shaped like a man, strong, nasty, barbed, and with a thirst for human blood. This movie was an excellent example of the belief that if it was different, than it had to be evil and out to get us, us being relative. The movie also included subtle digs about scientists and their search for knowledge at the cost of endangering mankind.

The Thing highlighted the ambivalent attitude we had towards science in the 50s. As much as we loved science, we were also a bit frightened of it and those who were its practitioners. After all, if it was science that would send us into space, it was also science that brought us the very real horror of nuclear war.

Not all visitors to the planet had hostile intentions. One of the best movies made during the 50s was the Day that the Earth Stood Still9 , with the alien out to save us from ourselves. Our parents liked the message, we liked the big robot that could zap everyone to ashes.

It was the Bomb and our fear of the Bomb (at least in hands other than our own), that became the second major theme of most sci-fi films of the 50s. We, the general populace, didn’t know exactly what side effects could be generated by this deadly weapon so we made a few up. With a little help from the movie makers, of course. The two most common effects of the Bomb used in movies at that time were common creatures grown to a monstrous size, and extinct animals, primarily dinosaurs, being awaken.

If you grew up in the 50s and 60s, you were exposed to some wonderful movie monsters. By today’s standards the monsters probably seem clumsy and pretty fake, but in that time it seemed to be so simple to suspend your beliefs and let your imagination roam. A special favorite was Them!10, with its full size monster ants. Them! was far superior to another movie of the time called Tarantula11, with its images of real life spiders blown up and superimposed with the movie actors. However, both movies did share a common theme: insects growing to an enormous size because of radiation.

The monsters didn’t just crawl around on the ground. Another of the better movies of the time, It Came from Beneath the Sea12, featured a giant octopus that attacks San Fransciso, courtesy of special effects master Ray Harryhausen. In this movie, the creature surfaces to seemingly try out the munchies on dry land for a change in diet or some such thing. And guess who the munchies, were, hmmm? Just call us Octo-Crunchies!

Another Harryhausen movie, The Beast from 20,000 Fathoms13, was about a pre-historic creature that was awakened from a frozen state by the detonation of an atomic bomb in the Arctic. This beastie decided to visit New York, taking in the sites, tearing down a few buildings, noshing on one of New York’s Finest instead of pretzels in the Park.

With many of these movies, the special effects used was the best available, but the real key to the enjoyment of the movies was not the effects so much as it was the suspense, and the ability to generate that pleasant, shivery feeling. Particularly effective was the use of the music. There is a distinctive sound that these old movies used when a creature was approaching our heroes, one that can’t be described but if you hear it, you know it. By providing “hints” of what is about to happen, the film makers built anticipation, but also provided a gentle warning so that the movie viewer was surprised by the appearance of the monster, but not so surprised or startled as to pass from pleasure to discomfort.

Lest you think great monster movies were only created in the 50s, some current movies also have created wonderful monsters. Steve Speilberg’s Jurassic Park is one of the best movies of all time with its incredible effects, excellent story line and adherence to some of the older movie formulas — most specifically by not being too graphic. In addition, as with the 50s movies, man rather than beast is the true culprit, this time the scientists messed with DNA rather than the atom. The end result, though, is pretty much the same — big critter eats smaller critter, smaller critter is us.

Oddly enough, out of all the movies that feature “monsters”, the most plausible movie monster is probably the giant squid from the Disney movie 20,000 Leagues Under the Sea14. Based on the Jules Verne book of the same name, the movie features a giant squid attacking the submarine that is the focus of both the book and the movie.

Though fictional, the squid shown in the movie and discussed in the story is not so large as to actually be outside of reality. Based on folk lore and legend, the giant squid can reach sizes of 100 feet or more. Add to this eyewitness accounts of giant squids attacking submarines and other ships, and you move much closer to fact than fiction with this story.

In fact, Jules Verne himself had heard a story of a giant squid attacking a military ship and based his monster on this story. A case of legend possibly becoming fact, which is as good a lead in as any to Part Two of A Tale of Two Monsters, covering Cryptozoology.

Categories
Just Shelley

Working at Home

Imagine this scenario: You get up in the morning, grab a cup of coffee, and wander out to the Living Room. You stand and gaze out the window for a few minutes taking advantage of that great mountain view. Then you casually go into your home office and start looking through your email. After you handle your email you take a shower and get dressed, sweats or jeans or shorts maybe, and you go back to your office and get down to some serious work. You break when you are tired and you eat when you are hungry. When the kids come home from school you chat with them about the day and maybe you even go for a walk with them. Later you get back on the computer for another few hours and quit for the night, satisfied with your day’s work.

Okay, everyone, you can stop crying now. And you can stop shaking your head,  saying this is impossible. With today’s technology, this is not only possible it is becoming cost effective and practical.

Today many of us have access to computers in our homes that enable us to do anything from creating a report, researching a product, to writing complex computer software. With the increased proliferation of ISDN lines and alternative connectivities being explored, we can connect with our jobs and have virtually the same access as we would sitting at a desk on site. And that office does not have to be in the same town.

Security? This does not have to be a limitation. We are learning more about computer security than ever and we are finding more ways to increase the safety of our systems.

Cost? How much does it cost you to maintain a workable environment for each of your people? If you are maintaining a site for a software developer you are maintaining software, a machine, a phone line, restrooms, an ergonomically designed workstation, and you are maintaining a location. That last one is a real key. Companies are growing and are finding that they may actually be running out of room to house their people, so they double up and cram people in and they lose productivity and they may actually lose people.

Teamwork? Have you had a chance to try out Netscape’s new version 3.0 beta software with LiveChat. I went out and talked and shared a virtual whiteboard with some person in Utah, and someone else in Texas. And this is a freebie add-on to an internet tool. You have the technology now to have cameras mounted on PCs and have people share virtual working spaces and work cooperatively online. The only thing you don’t share is bad breath.

Benefits? I bet if you promised this capability to people on only a partial week basis you will have increased worker satisfaction and a whole lot more people wanting to work for you. How about having to maintain less desk space if you have workers desk share? How about having fewer cars in your parking lot, which is probably overcrowded as it is. How about giving back to the community by fewer cars being on the road?

Sick Time? If you have an employee with a broken leg they can work at home. If they have a bad cold? The employee probably would come into work, be pretty uncomfortable and manage to pass their germs to half a dozen other people. Wouldn’t you rather they stay home? How about maternity or paternity leave? Nice option for those folks who would like to be available to their kids and still have a career. What a concept!

So, why is this not happening more? Some types of work just won’t make the transition to at home work such as factory and manufacturing processes and many services and other professions. If you have a home cleaning service, this usually means the customer’s home. And some companies are not set up yet, and may not be able to afford the type of setup that would enable their employees to work from home. Other companies may work on super secret stuff that has to be worked on behind armed guards and locked doors.

Now let’s look at the ‘bad’ reasons for not allowing people to work at home.

You don’t trust your employees and you have to have your eye on them at all times. Go Away. You have hired professionals and adults, consider treating them as such and you probably will not have the turnover you now have.

The work you do needs a centralized database. With the increased ISDN line connectivity, you can connect to your database efficiently from home. How about taking snapshots of the database to work on from your home PC? Concerned about someone accessing company secrets from this? Ask yourself this: Do you think that your secret is important enough that a person will break into your employee’s home to access their PC? Do you have armed guards at your front doors to keep people from walking in? Do you have absolutely no connection between your internal computer system and an outside connection? If you answered No to any of these, try a different mindset.

A legitimate concern is the availability of people for mentoring, or for brainstorming, or for any other cooperative task. You might want to consider how much of this really does occur and you then might want to consider a partial solution such as desk sharing: two people share a desk and a PC and work at home part of the week and at work part of the week.

Communication? Last I heard, homes had phones too, and email and internet connectivity…

Concerned about that security issue? Check with consultants in your area and find out the security risks. Don’t just assume that this type of connectivity will take your important systems down, find out the facts.

How about liability? Concerned that your employee may get hurt at home and sue you? Check with your lawyer and also your insurance companies about steps you and your employee can take. And lawyers and insurance companies, start understanding this type of business…it will only increase in the future.

Costs? You bet there will be costs to enabling off-site employees if they need computer access. But consider what you can get back: The main factor that raises envy in me and my professional peers is when one of us can work at home. It even beats out salary as the number one reason to take one job over another. And for most companies, the number one cost is their employees. Want to attract and keep the best?

There are a lot of issues to working at home. I would like to hear from companies that have made this transition successfully and would like to publish your success stories in the month’s to come. And I would also like to hear from those companies who have made a choice not to allow off-site employees and their reasons. Let’s start exploring this issue and see “Why we CAN work at home”.

That’s it, folks.

Categories
Just Shelley

Netscape Navigator’s JavaScript 1.1 vs Microsoft Internet Explorer’s JScript

Originally published in Netscape World, archived at the Wayback Machine

Prior to Netscape implementing JavaScript in Netscape Navigator, web developers had few tools to create interactive content for their web pages. Now this scripting language gives developers the ability to do things such as check form contents, communicate with the user based on their actions, and modify the web page dynamically without the web page being re-loaded and without the use of Java, plug-ins or ActiveX controls.

Unfortunately, JavaScript was not usable by any other browser until Microsoft released Internet Explorer (IE) 3.0. With this release web developers could deliver interactive content that would at least work with the two most widely used browsers. Or could they?

On the surface, the JavaScript supported by both companies is identical. They both provide the same conditional control statements, have defined objects such as window or document,and can be used directly in HTML documents. They both support events based on user actions and support functions in a similar manner. However, this article will demonstrate that though the languages may look the same on the surface, there are differences that can trip the unwary developer.

JavaScript Objects

To understand the differences between the two implementations of JavaScript you must examine the objects both support. As an example, with Navigator 3.0 Netscape provides a new object image which is an array (defined as images that contains the images in the document currently loaded. This object allows the developer to change the images of a document without re-loading the document or using Java or other technique. With this capability the developer can write the following JavaScript code section without error:


sSelected = "http://www.some.com/some.gif"
document.images[iIndex].src = sSelected

This code will change the src property of the image that is contained in the array at the index given in the variable iIndex. If this variable contained the value 2, the 3rd image as loaded in the document (the array indices begin at 0) would be changed to the image located in the given URL. An example using images can be found here.

Running the same example with Internet Explorer will result in a alert message that states that “‘images’ is not an object”.

Other examples of objects that are defined for Netscape Navigator but not for Microsoft Internet Explorer are:

  • The Area object, which is an array of links for an image map that allows the developer to capture certain events for the image map that can be used to provide additional information to the user. With this, the developer can capture a mouseOver event to write out information about the link in the status bar.
  • The FileUpload object which provides a text like control and a button marked with “Browse” that will allow a reader to enter a file name. The JavaScript can then access the name of the file.
  • The Function object which allows the developer to define and assign a function to a variable which can then be assigned to an event.
  • The mimeTypes Array of supported MIME types.
  • The option object which is an array of the options implemented for SELECT and which allows the developer to change the text of the option at runtime
  • The applet object, which is an array of Applets in the document (read-only)
  • The plugin object, which is an array called embeds that contains the plug-ins contained in the document (read-only)
  • The plugins array, which is an array of plug-ins currently installed in the client browser

At this time there are no JavaScript or JScript objects defined for Internet Explorer that are also not defined for Netscape. However, as JScript is an implementation script for IE and Microsoft has defined their own IE scripting model, this could change in the future.

JavaScript Object Behavior and Ownership

Internet Explorer may not have additional objects but it has defined a different hierarchy and ownership for some of the objects that are used by both it and Navigator. All objects are contained within the window object in the IE scripting model, which can be viewed here, but not all objects are owned by window with the Navigator model, which can be viewed with the JavaScript Authoring Guide. The object Navigator, which is the object that stores information about the browser currently being used, is an example of an owned object by window in IE but not in Navigator.

This will not present an incompatibility problem between the two browsers as the developer will usually not preface the object with the term “window” as the following code demonstrates:


<FORM NAME="form1">
<input type=button value='press' onClick="alert(navigator.appName)">
</FORM>

The above code will work with both browsers.

The differences between the ownership can become a problem when an object is owned by different levels of objects. An example is the history object, which is owned by the windowobject in IE, but by the document object in Navigator. When used in the current window and document, the object will work the same as the following code will demonstrate:


<FORM NAME="form1">
<input type=button value='press' onClick="history.back()">
</FORM>

The reason the same code can work for both is that window is assumed for both IE and Netscape and document is assumed for Navigator, at least in this instance because history is also an object in its own right. In the case of a document being opened as part of a frame, the differences then become noticeable. The following code will work when the document is opened as a frame in IE, but will not work in Navigator:


<body>
<script>
function clicked() {
history.back()
}
</script>
<FORM NAME="form1">
<input type=button value='press' onClick="clicked()">
</FORM>
</body>

Clicking on the button from the code above will work for IE. The previous document in the History list will be opened, but the same code will not work for Navigator. Clicking on the button will result in neither a change of document nor an error. Prefacing the history object with parent will enable this code to work with both browsers.

JavaScript Properties

Even when IE and Navigator share a common object and a common object ownership, they can differ on the properties for an object. An example is the document object. The properties for both implementations are the same except for an URL property for the Navigator implementation and a location property for the IE implementation. However, if you examine both properties, they are identical! Both contain the URL of the document. Both are read-only. The following code will work with Navigator, but results in an empty Alert message box for IE:


<FORM NAME="form1">
<input type=button value='press' onClick="alert(document.URL)">
</FORM>

According to Microsoft documentation, the equivalent for IE would be to use document.location.href. However, though this does not result in an error, it also results in an empty alert box. The following code achieves the desired results and, happily, works in both browsers:


<FORM NAME="form1">
<input type=button value='press' onClick="alert(location.href)">
</FORM>

The above example does demonstrate another area of caution when using the JavaScript language: this language is unstable in both environments and is changing continuously. Don’t assume something will work because the documentation states it will, and don’t assume it will work the same on all operating systems. Both browsers can have different behaviors across different operating systems, sometimes because of operating system differences and sometimes because of bugs that were missed during testing on that specific OS.

JavaScript Methods and Events

A web developer can find ways of working around differences in objects and properties, but working around differences in methods may not be so easy. When we develop we expect a certain behavior to result when we call a specific function and pass to it certain parameters. With Microsoft Internet Explorer and Netscape Navigator, the best case scenario is that we can use a pre-defined object method with both browsers and have the same result. The worst case scenario is that the method works with both browsers, but the result is different.

An example of the best case scenario is to use JavaScript to validate form field contents which have changed or to use these contents to calculate a value used elsewhere. Calling a JavaScript function from the onChange event to process the changed contents as demonstrated below will work with both browsers:


<!--- Form fields
<p>Item Quantity: <INPUT TYPE="text" Name="qty">
Item Cost: <INPUT TYPE="text" Name="cost"
                onChange="NewCost()">
Total Cost: <INPUT TYPE="text" Name="total" Value=0>
…
<!--- Function
<SCRIPT LANGUAGE="javascript">
<!--- hide script from old browsers

// NewCost will
// calculate cost of qty and item
function NewCost() {
        var iCost = parseFloat(document.Item.cost.value)
        var iQty = parseInt(document.Item.qty.value)

        var iTotal = iCost * iQty
        document.Item.total.value = iTotal
        }

The above will work as expected with both IE and Navigator. When the user enters a quantity and a cost, the onChange event will fire for the cost field and a JavaScript function called NewCost() will be called. This function will call two built-in JavaScript functions, parseFloat() and parseInt(), to access and convert the form field values. These will then be used to compute a total which is placed in the total field.

So far so good. Another JavaScript function in the web page will be processed when the user presses the submit button. This pre-defined button style will normally submit the form. The developer can capture the submission and perform validation on the fields. Coding this for Navigator would look like the following:


<FORM NAME="Item"
        ACTION="some.cgi" onSubmit="return SendOrder()">
…
<!--- Function
// submit order
function SendOrder() {

        // validate data
        if (document.Item.Name.value == "") {
                alert("You must enter your name")
                return false
                }
        return true
        }

Capturing the onSubmit event will allow the developer to call a function to process the form fields. If they choose, they can perform validation in this function. If the validation fails, say the user did not provide a name, the function notifies the reader and returns false, preventing the form from being submitted. If the user did provide a name, the function would return true, and the form would be submitted.

Following the documentation that can be found at the Microsoft site, the developer would expect something like this to work for IE as well as Navigator. It does, to a point.

With IE the onSubmit event is captured and the SendOrder() function is called. If the user did not enter a name value, an alert would occur. The behavior is the same for both browsers at this point. However, if the user does provide a value, Navigator would then submit the form and a follow-up form would be displayed. This does NOT occur with IE IF you are testing the page locally, probably due to a bug missed during the testing. It does work if you run the web page documents through a web server.

However, without knowing that the difference between the two results was a matter of document location rather than document coding the web page developer could have spent considerable time trying to get the same behavior for both browsers.

Aside from the differences already noted, the browsers may process code in a funtionally identical manner and yet perform quite differently. This can be demonstrated with another popular use of JavaScript which is to open a secondary window for some purpose and to maintain communication between the two windows. This is widely used by Netscape for their tutorials.

Both browsers support a property for the window object called opener. This property can be used to contain a reference to the window that opened the secondary window.

The following code demonstrates using JavaScript to open a secondary window and to set the opener property to the original window:


<HTML>
<HEAD><TITLE> Original Window </TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--- hide script from old browsers
// OpenSecondary will open a second window
//
function OpenSecond(iType, sMessage) {
        // open window
        newWindow=window.open("second.htm","",
                "toolbar=no,directories=no,width=500,height=300")
        // modify the new windows opener value to
        // point to this window
        if (newWindow != null && newWindow.opener == null)
                newWindow.opener=window

        }
// end hiding from old browsers -->
</SCRIPT>
</HEAD>
<BODY>
<H1> Open a new Window and get information</H1>

<FORM NAME="CallWindow">
<p>Click to open Window:
<p>
<INPUT TYPE="button" NAME="OpenWin" VALUE="Click Here"
        onClick="OpenSecond()">
<p>
</FORM>
</BODY>
</HTML>

The above HTML and JavaScript creates a simple document with one button. Pressing the button opens a new window (creates a new instance of the browser) that does not have a toolbar or directories and is set to a certain width and height. The HTML source document that is opened into this new window is “second.htm”.

The HTML and JavaScript in the secondary window is shown below:


<HTML>
<HEAD><TITLE> Information</TITLE>

<SCRIPT LANGUAGE="JavaScript">
<!--- hide script from old browsers
// SetInformation
// function will get input values
// and set to calling window
function SetInformation() {
        opener.document.open()
        opener.document.write("<BODY>")
        opener.document.write("<H1> Return from Secondary</h1>")
        opener.document.write("</BODY>")
        opener.document.close()
        opener.document.bgColor="#ff0000"
        window.close()
        }
// end hiding from old browsers -->
</SCRIPT>
</HEAD>
<BODY>
<p><form>
Click on the button:<p>
<INPUT type="button" Value="Click on Me"
     onClick="SetInformation()">
</CENTER>
</FORM>
</BODY>
</HTML>

This code will display a button labeled “Click on Me”. Pressing this button will result in the document page for the original window being modified to display the words “Return from Secondary”. The JavaScript will also change the background color of the original document and then will close the secondary window. When run in Navigator, the sample behaves as expected. Not so, however, with IE.

First, when you open the secondary window in IE you will notice that the document in the original window seems to blank out for a moment. In addition, the secondary window opens at the top left hand side of the desktop with IE but opens directly over the original window with Navigator, no matter where that original window is.

When you press the button that modifies the original document, IE does modify the document with the new header, as Navigator does, and the background on the original document will change briefly. However, when the secondary window is closed the background color of the original document returns to the original color!

What is worse is that running this sample for a few times with IE will cause the browser to crash! How soon it will crash seems to suggest that resources are not being freed, or are being freed incorrectly. Whatever the cause, this behavior should make a developer feel cautious about opening up a secondary window within IE.

Solutions to working with both Internet Explorer and Navigator

JavaScript is a useful tool for creating interactive content without using Java or some other technique. As we have seen, problems arise out of the incompatibility between Navigator and IE. What are ways to avoid these problems?

  • Code for one browser only. This is not really a viable solution. While Netscape Navigator is the most popular browser in use today, Microsoft Internet Explorer is gaining quite a following. Using Navigator-only JavaScript that will limit your web page’s audience.
  • Code only to the least common denominator. By limiting the JavaScript to that which works for both Navigator and IE, developers will have access to most of the functionality they need. However, with this approach developers will need to be aware of the gotchas that have been discussed in this article. In other words, the developer has to test with both browsers; the tests will have to occur via the web server as well as run locally; the tests should be repeated several times to ensure that no adverse effects show up over time; the code should be tested with all possible environments.
  • Code for each browser within the same page. This is actually my favorite approach though it will require more effort by the developer. Both browsers will process JavaScript labeled as <SCRIPT LANGUAGE=”javascript”>, however only Navigator will process script labeled as <SCRIPT LANGUAGE=”javascript1.1″>. With this approach, the developer can place JavaScript common to both browsers in a SCRIPT tag labeled with “javascript” and Navigator specific code in a SCRIPT tag labeled with “javascript1.1”. To add in IE specific code, the developer would probably want to use VBScript code or use the tag JScript whenever applicable. At this time, JScript is implemented for scripting with events only, not as a language specification for the SCRIPT tag.

Summary

JavaScript is a very effective tool, and a relatively simple method for adding interactive content to a web page. With version 3.0 of Internet Explorer, using JavaScript is viable for both of the most popular browsers in use. However, developersneeds to be aware of the differences between Netscape Navigator and Microsoft Internet Explorer and should test thoroughly with both before posting the page to their site.