[Javascript] span section

Dan Costea costea.dan at ssi-schaefer.ro
Tue Nov 12 07:05:39 CST 2002


bacause at the moment you execute the script, you don't have a "mySpan"
object; it will be declared 4 lines below.

----- Original Message -----
From: "Andrzej Wróblewski" <alfwro at wp.pl>
To: <javascript at LaTech.edu>
Sent: Tuesday, November 12, 2002 2:55 PM
Subject: Re: [Javascript] span section


> > 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.?
> > >
> > >
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript




More information about the Javascript mailing list