J
jason
I have a very simple asp.net 2.0 page with one textbox that onkeyPress
is suppose to do some check of what was typed. Below is the source
showing the javascript function is available. The minute I strike a key
I get the error. Anybody know why?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script language="javascript" type="text/javascript ">
function ValidateNumeric()
{
var keyCode = window.event.keyCode;
if (keyCode > 57 || keyCode < 48)
window.event.returnValue = false;
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head><title>
Untitled Page
</title></head>
<body>
<form name="form1" method="post" action="Default3.aspx" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"
value="/wEPDwUJMjgzMDgzOTgzD2QWAgIDD2QWAgIBDw9kFgIeCm9uS2V5UHJlc3MFElZhbGlkYXRlTnVtZXJpYygpO2RkNE+rQ47DvNQ43x5HqyR5GtSr/xo="
/>
</div>
<script type="text/javascript">
<!--
var theForm = document.forms['form1'];
if (!theForm) {
theForm = document.form1;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
// -->
</script>
<script
src="/firstmaster/WebResource.axd?d=1cOHSBDcUybKo8LLKYn7Sw2&t=632886338900000000"
type="text/javascript"></script>
<div>
<input name="TextBox1" type="text" id="TextBox1"
onKeyPress="ValidateNumeric();" /></div>
<div>
<input type="hidden" name="__SCROLLPOSITIONX" id="__SCROLLPOSITIONX"
value="0" />
<input type="hidden" name="__SCROLLPOSITIONY" id="__SCROLLPOSITIONY"
value="0" />
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value=""
/>
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT"
value="" />
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION"
value="/wEWAgLO+I33BQLs0bLrBlhWg+CjAmuM6TyVJKn2rdkeNUlP" />
</div>
<script type="text/javascript">
<!--
theForm.oldSubmit = theForm.submit;
theForm.submit = WebForm_SaveScrollPositionSubmit;
theForm.oldOnSubmit = theForm.onsubmit;
theForm.onsubmit = WebForm_SaveScrollPositionOnSubmit;
// -->
</script>
</form>
</body>
</html>
is suppose to do some check of what was typed. Below is the source
showing the javascript function is available. The minute I strike a key
I get the error. Anybody know why?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script language="javascript" type="text/javascript ">
function ValidateNumeric()
{
var keyCode = window.event.keyCode;
if (keyCode > 57 || keyCode < 48)
window.event.returnValue = false;
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head><title>
Untitled Page
</title></head>
<body>
<form name="form1" method="post" action="Default3.aspx" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"
value="/wEPDwUJMjgzMDgzOTgzD2QWAgIDD2QWAgIBDw9kFgIeCm9uS2V5UHJlc3MFElZhbGlkYXRlTnVtZXJpYygpO2RkNE+rQ47DvNQ43x5HqyR5GtSr/xo="
/>
</div>
<script type="text/javascript">
<!--
var theForm = document.forms['form1'];
if (!theForm) {
theForm = document.form1;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
// -->
</script>
<script
src="/firstmaster/WebResource.axd?d=1cOHSBDcUybKo8LLKYn7Sw2&t=632886338900000000"
type="text/javascript"></script>
<div>
<input name="TextBox1" type="text" id="TextBox1"
onKeyPress="ValidateNumeric();" /></div>
<div>
<input type="hidden" name="__SCROLLPOSITIONX" id="__SCROLLPOSITIONX"
value="0" />
<input type="hidden" name="__SCROLLPOSITIONY" id="__SCROLLPOSITIONY"
value="0" />
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value=""
/>
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT"
value="" />
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION"
value="/wEWAgLO+I33BQLs0bLrBlhWg+CjAmuM6TyVJKn2rdkeNUlP" />
</div>
<script type="text/javascript">
<!--
theForm.oldSubmit = theForm.submit;
theForm.submit = WebForm_SaveScrollPositionSubmit;
theForm.oldOnSubmit = theForm.onsubmit;
theForm.onsubmit = WebForm_SaveScrollPositionOnSubmit;
// -->
</script>
</form>
</body>
</html>