[Javascript] netscape: how to write to <div> tag??

Andrew Gibson andyg at ihug.co.nz
Tue Jun 26 21:01:47 CDT 2001


not sure if you can in NS but in IE you would just go something like

var txt=document.all['mylayer'].innerHTML  ;
document.all['mylayer'].innerHTML=txt+newtext  ;

Let us know if you get this to work in NS.

Andrew Gibson


 > 
 > 
 > incidently, i noticed that writing the <div>
 > overwrites what was previously there...any way to
 > append to the contents of <div> rather than writing
 > over it?
 > 
 > 
 > 
 > --- "Anthony E." <apwebdesign at yahoo.com> wrote:
 > > i forgot the close() tag...but also, I have to
 > > define
 > > the <div> tag with a stylesheet too!
 > > 
 > > <div id="div1" style="position: absolute">
 > > </div>
 > > 
 > > this works in IE and NS!
 > > 
 > > --- Andrew Gibson <andyg at ihug.co.nz> wrote:
 > > > from memory I think you need to go
 > > > 
 > > > document.layers["div1"].document.write("hello")
 > > > document.close()
 > > > 
 > > > Andrew Gibson
 > > > 
 > > >  > I can write to <div id="div1"> in IE4, but not
 > > in
 > > >  > Netscape 4.7
 > > >  > 
 > > >  > I've tried the following without any
 > > > success...please
 > > >  > help to write to NS 4 <div> ('layers'):
 > > >  > 
 > > >  > =========
 > > >  > 
 > > >  > 
 > > >  >   <script language="JavaScript">
 > > >  >   <!-- 
 > > >  >   function layer() {
 > > >  >     if (!document.all) {
 > > >  >      
 > > > document.layers["div1"].document.write("hello
 > > >  > NS");
 > > >  >     } else if (document.all) {
 > > >  >       document.all["div1"].innerHTML = "Hello
 > > > IE";
 > > >  >     }
 > > >  >   
 > > >  >   }
 > > >  >   
 > > >  >   // -->
 > > >  >   </script>
 > > >  > 
 > > >  > =========
 > > >  > 
 > > >  > <a href="javascript:layer();">Click</a><br>
 > > >  > 
 > > >  > <div id="div1">
 > > >  > div 1 layer
 > > >  > </div>
 > > >  > 
 > > >  > =========
 > > >  > 
 > > >  > =====
 > > >  > --
 > > >  > Anthony E.
 > > >  > AP Web Design
 > > >  > 
 > > >  >
 > > > __________________________________________________
 > > >  > Do You Yahoo!?
 > > >  > Get personalized email addresses from Yahoo!
 > > Mail
 > > >  > http://personal.mail.yahoo.com/
 > > >  > 
 > > >  > _______________________________________________
 > > >  > Javascript mailing list
 > > >  > Javascript at LaTech.edu
 > > >  >
 > > http://www.LaTech.edu/mailman/listinfo/javascript
 > > >  > 
 > > > 
 > > > _______________________________________________
 > > > Javascript mailing list
 > > > Javascript at LaTech.edu
 > > > http://www.LaTech.edu/mailman/listinfo/javascript
 > > 
 > > 
 > > __________________________________________________
 > > Do You Yahoo!?
 > > Get personalized email addresses from Yahoo! Mail
 > > http://personal.mail.yahoo.com/
 > > 
 > > _______________________________________________
 > > Javascript mailing list
 > > Javascript at LaTech.edu
 > > http://www.LaTech.edu/mailman/listinfo/javascript
 > 
 > 
 > __________________________________________________
 > Do You Yahoo!?
 > Get personalized email addresses from Yahoo! Mail
 > http://personal.mail.yahoo.com/
 > 
 > _______________________________________________
 > Javascript mailing list
 > Javascript at LaTech.edu
 > http://www.LaTech.edu/mailman/listinfo/javascript
 > 




More information about the Javascript mailing list