<script language="javascript">
function isNumber(String)
{
var Letters = "1234567890";
var i;
var c;
for( i = 0; i < String.length; i ++ )
{
c = String.charAt( i );
if (Letters.indexOf( c ) < 0)
return false;
}
return true;
}
function CheckForm()
{
if (!isNumber(document.myform.scale.value)) {
alert("You must input a num for the scale!");
document.myform.scale.focus();
return false;
}
if (!isNumber(document.myform.replication.value)) {
alert("You must input a num for the replication!");
document.myform.replication.focus();
return false;
}
if (document.myform.scale.value.length == 0) {
alert("Please input the scale of the cluster!");
document.form.myform.focus();
return false;
}
if (document.myform.replication.value.length == 0) {
alert("Please input the replication of the cluster!");
document.form.myform.focus();
return false;
}
return true;
}
</script>
<form action="/horizon/project/" method="post" name="myform" onsubmit="return CheckForm()">
<label>Scale</label>
<input type="text" name="scale" />
<br />
<label>Replication</label>
<input type="text" name="replication" />
<br />
<input type="submit" value="Launch" />
</form>
form1.action="*.action";
form1.submit();
您这两行是什么意思啊,能不能解释下。谢谢
您写的确实舒服多了。问下,和是不是没啥区别啊?
另外我上面哪个,如果返回了false,是不是不该跳转了,但是实际上还是跳转了,您再帮忙看下。谢了