Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: Re: Javascript - Common for IE & Netscape


Message #1 by "Zay Perez" <zay_perez@h...> on Tue, 22 Jan 2002 06:02:59
> 
> Hi all,
> 
>    I have some Javascripts, which is working fine
> in Netscape, but not in IE. How to trace out the 
> common features of Javascript, which will work 
> fine in both IE & Netscape. 
> 
> your help is very much appreciated. 
> 
> Regards,
> Shankar
> 
> 
>  


hi! these reminders might help you in adapting your scripts for both 
netscape and ie.

1. complete the object hierarchy of the controls. for example: if you have 
a textbox named text1 located inside a form named form1, write it in 
javascript as:
          document.form1.text1.<property>
2. if you're using spans, when using netscape, used the getElementByID 
property of the document to refer to the span. for example:
          document.getElementById("<span_name>").<property>
3. detect what browser you're using by this code:
      if (navigator.appName.indexOf("Explorer") >= 0) {
       ...
      }
   OR
      if (navigator.appName.indexOf("Netscape") >= 0) {
       ...
      }

hope this helps =)

  Return to Index