Hi
use == instead of equals. It will solve the bug, but the for loop you r
using is not sufficient for your requirement i think.
bye
-sunil
>From: s saravanan <[EMAIL PROTECTED]>
>Reply-To: "A mailing list for discussion about Sun Microsystem's Java
> Servlet API Technology." <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: help on special characters?
>Date: Fri, 1 Dec 2000 05:35:39 -0800
>
>Hi everybody,
>
> Can anybody help me how to validate special characters in Javascript.
>
> It should not accept the characters which i used in array
>declaration.In the below it shows some error.
>
> Anybody can help me immediately!!!
>
>thnx
>sar.
>
>
>
>
>
>My part of code is:
>*********************
>
><script language=javascript>
>function myfunc()
>{
> var str=new Array("~","!","#","$","%","^","&","*");
> var ss=document.f1.un.value;
>
>
> for(i=0;i<str.length;i++)
> {
> if(ss.substr(i,i+1).equals(str[i]))
> { alert("special character not allowed");
> return(document.f1.un.value="");
> }
> }
>}
>
>
>
><input type="text" name="un" maxlength="10" onblur="myfunc()">
>
>
>
>
>
>_____________________________________________________________________________________
>Get more from the Web. FREE MSN Explorer download :
>http://explorer.msn.com
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
_____________________________________________________________________________________
Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html