Javascript: Variable scope question

jmcd9336 jmcd9336
Mon May 17 11:37:44 PDT 2004


Are you explicitly accessing the dom i.e using window. or document. ?

Also are you using methods defined in a later javascript version while the 
browser only paritially supports EMCAScript or javascript 1.whatever 

netscape has some great js resources

http://developer.netscape.com/docs/manuals/js/core/jsref14/index.htm

<body>
<form name="form1" action="none">
   Big long form
   <input type=checkbox name=checkbox1>
</form>
<script language="javascript">
document.form1.checkbox1.checked = true;
</script>
</body>
</html>



On Sun, 8 Sep 2002 05:25, Joel Hammer wrote:
> I would appreciate it if anyone could comment on this.
>
> I have written a long javascript, which, at the end of the day, only runs
> on Opera and IE. (netscape, galeon, konqueror, mozilla  all fail to run
> correctly.)
>
> I am trying to track down why netscape 6.2 won't work.
> One reason seems to be the typeof command. Netscape doesn't seem to support
> it. This is a small annoyance.
>
> But, a very big problem seems to be variable scope.
>
> It is looking like IE and opera will allow a function to simply use a
> global variable whereas Netscape insists that the variable, at least if it
> is an array, be explicitly passed to it. This is fixable.
>
> The third problem I don't know how to describe in few words. So, I'll give
> the example:
> <html>
> <body>
> <form name = "form1" action = "none">
>    Big long form
> </form>
> <script>
> form1[1].checked = true
> </script>
> </body>
> </html>
> Results in a form1 not defined error.
> The odd thing is, netscape's later behavior indicates it knows about form1.
>
> Opera and IE handle this situation just fine.
>
> So, I am confused.
>
> Any insight appreciated.
> Joel
>
>
> _______________________________________________
> Linux-users mailing list
> Linux-users at linux-sxs.org
> Unsubscribe/Suspend/Etc ->
> http://www.linux-sxs.org/mailman/listinfo/linux-users




More information about the Linux-users mailing list