...
var confirmCodePattern = /g(b+)g/g;
var confirmCodePatternOccurs = confirmCodePattern.exec(field.value);
[B]alert("length: " + confirmCodePatternOccurs.length);
[/B] [B] if (confirmCodePatternOccurs.length < 2){[/B]
alert("Wrong format of confirm code");
document.getElementById("row7").style.background = "#FF4040";
return false;
...
return true;
5 replies to this topic
#1
Posted 16 April 2011 - 12:17 PM
I would be greatful if enyone could explain me why this piece of code produces error at bolded lines. First and second lines are executed corectly
|
|
|
#2
Posted 16 April 2011 - 01:15 PM
What is the error message?
#3
Posted 17 April 2011 - 09:39 AM
If exec fails to match the string, it returns null. Maybe you get a nullpointer by that.
#4
Posted 18 April 2011 - 03:36 AM
Actually, i don't know error message, because i code in simple text editor (i am new to javascript). Maybe you could recommend any good javascript IDE? I assume i get error in that line because code stops being executed
#5
Posted 18 April 2011 - 04:12 AM
The error should be shown in the browser.
press F12 and click the Script tab in IE.
CTRL+Shift+J in chrome.
And something else for firefox :P
press F12 and click the Script tab in IE.
CTRL+Shift+J in chrome.
And something else for firefox :P
#6
Posted 18 April 2011 - 08:03 AM
I have figured out that i got error because i tried to find size of array which was null. Thanks for help
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









