All,
I have a javascript function that prevents users from entering non-numeric values into
a textbox.
I add the function to the onkeypress for the textbox in the code-behind page.
When I press any key, I am getting an 'object expected' error.
Here is the line of code in the code-behind page that adds the function call the
textbox:
txtUnitPrice.Attributes.Add("onkeypress", "javascript:return NumericOnly();")
And here is the javascript function:
function NumericOnly(){
var valid = "0123456789."
var testChar;
testChar = String.fromCharCode(event.keyCode);
if (valid.indexOf(testChar) == "-1") {
return false; }
else {
return true;
}
}
Doea anyone see what I am doing wrong?
Thanks,
Mark
[Non-text portions of this message have been removed]
------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/