Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: RE: Javascript with netscape


Message #1 by "BalaMualiKrishna Malireddi" <krishnab@t...> on Wed, 12 Feb 2003 06:44:58
	It's apparently a bug in Mozilla.  I've filed a bug report here :
http://bugzilla.mozilla.org/show_bug.cgi?id=3D193373

> -----Message d'origine-----
> De : BalaMualiKrishna Malireddi [mailto:krishnab@t...]
> Envoy=C3=A9 : mercredi 12 f=C3=A9vrier 2003 07:45
> =C3=80 : javascript
> Objet : [javascript] RE: Javascript with netscape
>
>
> Iam using NS 6.1 and the focus is going to the next text box after 
the
> alert message. Is there any other way to handle this in NS?
>
> Murali
>
> > Your problem is not helped by FrontPage producing some
> dodgy HTML - try
> > using something like HTML tidy from the W3 site which
> validates and tidies
> > up HTML.  Anyway back to your problem - Netscape is very
> touchy about
> > using the document object to refer to forms etc.  So try using
> > value=3Ddocument.form1.text1.value and so on.  In general the
> way to do
> > validation is to use the onBlur or onChange events.  Here's
> an example
> > which works in NS and IE:
> > <html>
> > <head>
> > <title>Focus validation</title>
> > <script language=3D"Javascript" type=3D"text/javascript">
> > <!--
> > function window_onLoad()
> > {
> >     document.form1.text1.focus();
> > }
> >
> > function check1 (textObj)
> > {
> >         var value;       
> >         value =3D textObj.value;
> >         if (value !=3D "First" )
> >         {
> >            alert("Something wrong, try again!");        
> >            textObj.focus();
> >            textObj.select();
> >            return false;       
> >        }
> >        return true;
> >  }
> > //  -->
> > </script>
> > </head>
> > <body bgcolor=3D"#eeeeee" onLoad=3D"window_onLoad();">
> > <form name=3D"form1" id=3D"form1" onsubmit=3D"return check1
> > (document.form1.text1);">
> >     <p>Please enter "First" in first textbox</p>       
> >     <input id=3D"text1" name=3D"text1" 
onBlur=3D"check1(this);"><br>
> >     <input name=3D"text2" id=3D"text2" >
> > </form>
> > </body>
> > </html>

  Return to Index