[Javascript] span section
Andrzej Wróblewski
alfwro at wp.pl
Tue Nov 12 06:55:53 CST 2002
> You probably need to use an onload event
>
> <body onload=javascript:writeIt()>
>
> then
> function writeIt()
> {
> document.getElementById("mySpan").innerHTML="Whatever" ;
> }
thank You it works !!
But ... tell me why this is wrong:
<HTML>
<HEAD>
<script>
document.getElementById("myspan").innerHTML="Whatever" ;
</SCRIPT>
</HEAD>
<BODY>
<span id="myspan">
</span>
</BODY>
</HTML>
debugger return error: 'document.getElementById(...)' is empty or is
not an object
Why's that?
Regards
andrzej
> > If I create a span section i the <body>:
> >
> > <html><head>
> > <script>
> > var textToInsertSpan = "Some text"
> > document.spanName?????????????? = textToInsertSpan
> > </script>
> > </head><body>
> > <span name="spanName">
> > </span>
> > </body></html>
> >
> > how using JavaScript in the <head> section put text into <span>
> > sect.?
> >
> >
More information about the Javascript
mailing list