大家好!
我在我的项目验证使用下面的JavaScript代码的文本框的值。此代码在IE浏览器,但没有任何其他的浏览器。任何人都可以帮助我这个问题。
这是隐藏文件的代码:
这是我的javascript代码:
protected void Page_Load(object sender, EventArgs e)
{
txtInvNopr.Attributes.Add("onblur", "return validate(this.value)");
}
{C}
在此先感谢!| ManavGuru |曼弗雷德河Bihy:这个例子只使用javascript。它运行在IE 8/9,火狐6.0.2和Chrome 12.xxxx绝对完美。
<html>
<head>
<script type="text/javascript">
function validate(content)
{
if(isNaN(content)==true)
{
alert('Enter Only Numeric Value');
return false;
}
else
return true;
}
</script>
</head>
<body>
<h1>Get attribute test!</h1>
<input id="btnClientId" type="text" value="" name="Whatchamacallit" onblur="return validate(this.value);"/>
<input id="submitIt" type="button" value="Do it!"/>
</body>
</html>
它必须是别的东西,会在你的代码的错误。请使用Firebug来调试你的页面的JavaScript。
的问候,
mdash;如MRB