Don,
Did you remove the white space in front of "var b;"?
I have seen this before when I copy code from another editor to Interdev -
could there be some hidden TAB or something in that white space?
Regards,
John
-----Original Message-----
From: Don Woo [mailto:dwoo@r...]
Sent: 12272000 12:26 AM
To: javascript
Subject: [javascript] "Invalid Character"
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!!!!!!
---
NEED TECHNICAL TIPS, TOOLS, AND INSIGHTS? Is FREE okay?
Visit EarthWeb for the latest in IT Management, Software Development,
Web Development, Networking & Communications, and Hardware & Systems.
Click on http://www.earthweb.com for FREE articles, tutorials,
and discussions from the experts.
---
You are currently subscribed to javascript as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-javascript-$subst('Recip.MemberIDChar')@p2p.wrox.com