In asp, how can I restrict the "submit" buttonto just clicking by mouse other than press "enter" on the keyboard????
always presss "enter" on keyboard unknowingly, it is really troublesome....[survivor (2-9 12:00, Long long ago)]
[ 传统版 |
sForum ][登录后回复]1楼
try this<input type="button" name="submit" onclick="document.yourformname.submit()">[阿不错 (2-9 18:02, Long long ago)] [ 传统版 | sForum ][登录后回复]2楼
(引用 阿不错:try this...)it is doesn't work,,,anyohter suggestion?[survivor (2-10 8:56, Long long ago)] [ 传统版 | sForum ][登录后回复]3楼
(引用 阿不错:try this...)can explain wat's the use of "on press" and "on click"[survivor (2-10 9:22, Long long ago)] [ 传统版 | sForum ][登录后回复]4楼
(引用 阿不错:try this...)code like thistype error in the post above: name="submit" should be value="submit"
or, u can use code like this
-------------------------------
<html>
<head>
<script language="javascript">
function func_submit(myform){
myform.target="_self";
myform.action="detail.asp";
myform.submit();
}
</script>
</head>
<body>
<form name="form1" method="post">
<input name="name" type=text></input>
<input type="button" value="click me" onclick="func_submit(document.form1)">
</form>
</body>
</html>[阿不错 (2-10 10:53, Long long ago)]
[ 传统版 |
sForum ][登录后回复]5楼
(引用 阿不错:code like thistype error in the post above: name="submit" should be value="submit" or, u can use code like this ---------------...)I am using vb script, can u show me in that way,,,thx first[survivor (2-10 11:35, Long long ago)] [ 传统版 | sForum ][登录后回复]6楼
(引用 阿不错:code like thistype error in the post above: name="submit" should be value="submit" or, u can use code like this ---------------...)I tried urs, but pressing "enter" is still working.I wanna disable "enter key"[survivor (2-10 14:46, Long long ago)] [ 传统版 | sForum ][登录后回复]7楼
(引用 survivor: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> [阿不错 (2-10 16:12, Long long ago)]
[ 传统版 |
sForum ][登录后回复]8楼
(引用 阿不错:add a check function
function check(){
if (document.form1.flag.value=="")
return false;
else
return true;
}
function fun...)it works for just one test field, if I have more than 2 text field , thenit will not work...
"let's say user just enter one text field, then press "enter" on the keyboard, the"Press" key is still working, am I right?
阿不错 [survivor (2-10 16:16, Long long ago)]
[ 传统版 |
sForum ][登录后回复]9楼
(引用 survivor:it works for just one test field, if I have more than 2 text field , thenit will not work... "let's say user just enter one tex...)could be any text fieldsas long as the check function works[阿不错 (2-10 17:32, Long long ago)] [ 传统版 | sForum ][登录后回复]10楼