Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Re: "Invalid Character"


Message #1 by rajeshsankara@h... on Sat, 22 Sep 2001 23:08:33
Hi don,

I have the same problem with the I.E 5.0 not with i.e 6.0.

What i didnt is I just retyped the whole javascript and it is working fine.

No copy and paste, it wont work. Try that.. good luck.

Rajesh

> I have a client-side script that's does a pattern check on some input
> text, mainly date, time, or datetime data.  My code works fine in IE, but
> under Netscape 4.7, I keep getting an invalid character error. If I
> look under the Java Console (type "javascript: in the URL") it says
> 
> "illegal character."
> "          var b;  "
> ".....^            "
> 
> Which doesn't make any sense.
> My function code is:
> 
> function MRE()
> {
>     var a;
>     var b;
>     var strg = arguments[0];
>     var mode = arguments[1];
> 	    
>     switch(mode)
>     {
>  	case 1:	//DateField
>    		b = "\\d?\\d/\\d?\\d/\\d\\d";
> 	case 2:	//TimeField
> 		b = "\\d?\\d:\\d?\\d:\\d?\\d";
> 	default:	//DateTimeField
> 		b = "\\d?\\d/\\d?\\d/\\d\\d\\s\\d?\\d:\\d?\\d:\\d?
>                      \\d\\sAM|PM";
>     }	
>     a = new RegExp(b, "i");
>     window.alert(a.test(strg));
>     return a.test(strg);
> }
> 
> I was using direct variables in the function declaraion:
> "MRE(strg,mode)",  but was trying anything to solve this weird problem.
> I even tried retyping it. I am using Interdev to develop my code.
> I move the code to some other location on my page, but the problem
> followed...... For a while, the smae error was appearing on the
> line with my "switch" statement, not sure how or why it moved.....
> help!!!!!!

  Return to Index