[thelist] JS Rookie Needs Help

Saila, Craig Craig.Saila at bgminteractive.com
Tue Dec 17 12:49:01 CST 2002


> -----Original Message-----
> From: Brian W. Reaves [mailto:brian at brianreaves.com]
> Sent: December 17, 2002 1:34 PM

> What is wrong with this:
>
> <layer name="now" id="now" width="80px" height="80px">I Need
> HELP!!!</layer>
>
> <script language="JavaScript" TYPE="TEXT/JAVASCRIPT">
> <!--
>
> document.now.bgColor="blue";
>
> // -->
> </script>
>
> It works in NS 4X but not IE6 or Op6...

It's not yr JavaScript, it's the HTML: LAYER is NN4 only. The proper way
is to use a DIV:
 <div id="now" style="width: 80px; height: 80px">I Need HELP!!!</div>

And then change the style by calling this in yr JavaScript:
 document.getElementById("now").style.backgroundColor = "blue";

Should work in IE 5+ (maybe 4), NN6+, and probably Opera 6 (definitely
in Opera 7).

--
Cheers,

Craig Saila
------------------------------------------
craig at saila.com : http://www.saila.com/
------------------------------------------



More information about the thelist mailing list