在form中的文本框回车后,执行action的问题!!
请先看代码
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=shift-jis">
<title>text</title>
<body leftmargin="0" rightmargin="0" topmargin="0" >
<form name="myform" method="post" action="TriggerSave" target="_parent" >
<table width="100%" height="573" border="0" cellpadding="1" cellspacing="1">
<tr>
<td width="8%" height="137"> </td>
<td width="92%" valign="top"><table width="75%" height="114" border="0" cellpadding="1" cellspacing="1">
<tr bgcolor="#FFFFFF">
<td height="112" colspan="6"><table width="621" height="99" border="0">
<tr>
<td width="302"><table width="303" border="0" cellpadding="1" cellspacing="1">
<tr>
<td class="normal2">文本名
<input class="normal" type="text" name="yakuzaimei" value = "" >
<input class="button" type="button" name="showtable" onClick=" show()" value="检索"></td>
</tr>
<script>
function show(){
if(document.myform.yakuzaimei.value==""){
alert("不能为空")
document.myform.yakuzaimei.focus();
return false;
}else{
document.myform.action = "Yakuzai";
document.myform.submit();
}
}
</script>
</table>
</form>
我希望在文本框中回车执行的是<script>中的adocument.myform.action = "Yakuzai";
,不执行form中的action,怎么做?from中的action另外有用处不能再form中写“onclick = “show()””。请问怎样写?