- basic scripting -

       What to Change?
.   .   .

With dHTML, you can change more than just the position of an object. In Microsoft, you can change any CSS property that is defined using style="". However, in Netscape, there are only five things that can be changed. They are:

  • top
  • left
  • bgcolor
  • visibility
  • z-index

Why does Netscape only have five things to change, and Microsoft over twenty things? When Netscape was making it's dHTML, it created it much differently than Microsoft. Netscape wanted everything to made of <layer> tags. Layer tags are very similar to span and div tags. They are named objects with properties just like a span tag is. Here's what a layer tag looks like. Note the differences.

<layer name="urbgnme" top=10 left=10 bgcolor=red z-index=5 visibility="show">

Notice how the layer is named by name="" rather than id="". The CSS properties aren't put in a style="". Here's a critical fact: notice how many CSS properties are defined. Five are. Notice how only five properties can be defined with a layer tag, and only five properties can be changed using dHTML.

In our example script, we didn't use any layer tags. Why? The span tag can take place of the layer tag. In fact, even though only five properties can be defined with a layer tag in Netscape, all CSS properties except width and height can be defined with a span tag. Why? I have no clue. However, in dHTML, only four of those properties can be changed. bgColor can only be changed if you use a layer tag in Netscape.

When using a layer tag in Netscape, the dHTML is still the same. Are you confused yet? I am just writing this!

What can Microsoft Internet Explorer 4.0 change? Here it is:

  • everything

I think I know which browser you like better. I know I like Microsoft Internet Explorer better. Some good news too. Netscape 6.0's dHTML is very similar to MIE 4.0's, yet it's still flawed. The layer tag idea was rejected!

How do you change things other than top and left? Just do the same thing, except change the end. For example, if I wish to change the width of an object, it would look like this:

theObj.style.width = 280;

That's only in MIE 4.0, since we know that NN doesn't let you change the bgcolor with a span tag. It has to be a layer tag. Anyways, what if your property has a dash in it like z-index or font-family. Erase the dash and make the second word's first letter capitalized like this:

theObj.style.fontSize = 12;

So then, how about changing an image's width and height. Just add style="" to the end of the tag and name it something. No need for a span or div tag. Just like this:

<img src="url" name="theImg" style="width: 200; height: 200;">

Then do a similar dHTML thing to change the width to...let's say 400 pixels.

theImg.style.width = 400;

You should know by now that this won't work in Netscape. Sucks, don't it?

Now that you know what can be changed with each browser, let's create one more thing with some more advanced dHTML. The sliding menu.

next >>

.   .   .

  1. Introduction
  2. What, Exactly, is it?
  3. The [object]
  4. Detecting Browsers
  5. Accessing Properties
  6. Making a Script
  7. Making the Script in Netscape
  8. What to Change?
  9. Creating a Menu
  10. Scripting the Menu
  11. The Netscape Menu
  12. Last Words