在form中的文本框回车后,执行action的问题!!

accpcj 2005-09-12 05:27:02
请先看代码

<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()””。请问怎样写?
...全文
119 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
accpcj 2005-09-12
  • 打赏
  • 举报
回复
wzrain(晨雨) 兄台,onsubmit="javascript:show();"加了,还是不对!
accpcj 2005-09-12
  • 打赏
  • 举报
回复
from中的action另外有用,不能为空的。action=""不可以!
accpcj 2005-09-12
  • 打赏
  • 举报
回复
onsubmit="javascript:show();"
在哪里加??文本框里面么??
wzrain 2005-09-12
  • 打赏
  • 举报
回复
action=""
wzrain 2005-09-12
  • 打赏
  • 举报
回复
onsubmit="javascript:show();"

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧