I tried urs, but pressing "enter" is still working.I wanna disable "enter key"
add a check function
<html>
<head>
<script language="javascript">
function check(){
if (document.form1.flag.value=="")
return false;
else
return true;
}
function func_submit(myform){
myform.flag.value="anyvalue"
if (check()){
myform.target="_self";
myform.action="detail.asp";
myform.submit();
}
}
</script>
</head>
<body>
<form name="form1" method="post" onsubmit="return check()">
<input name="name" type=text></input>
<input type="hidden" name="flag" value="">
</form>
<input type="button" name="btnsubmit" value="click me" onclick="func_submit(document.form1)">
</body>
</html>
<head>
<script language="javascript">
function check(){
if (document.form1.flag.value=="")
return false;
else
return true;
}
function func_submit(myform){
myform.flag.value="anyvalue"
if (check()){
myform.target="_self";
myform.action="detail.asp";
myform.submit();
}
}
</script>
</head>
<body>
<form name="form1" method="post" onsubmit="return check()">
<input name="name" type=text></input>
<input type="hidden" name="flag" value="">
</form>
<input type="button" name="btnsubmit" value="click me" onclick="func_submit(document.form1)">
</body>
</html>