问一个很基础的问题~

xiaoer123 2003-12-02 11:26:18
刚刚接触jsp,请问各位大虾:

在什么情况下才能够响应form 里边的action参数的值?
也就是请您给我讲讲 <form> <input>的关系。

因为我看到有些代码是当input=submit的时候,点击按钮后,触发action里边的事件,但是有些form里边没有这一类的按钮,也同样能够触发,那些按钮都有自己的click事件,这个时候是怎么实现的?


我现在知道的仅仅是input=submit的时候。

谢谢您~~
...全文
69 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
lu8088 2003-12-02
  • 打赏
  • 举报
回复
form.action=xxxxx;
form.submit();

from中的东西是可以提交的,提交到action=abc.html or action=abc.jsp
当<input type=submit>时,点击会提交。提交给input所在的<from></from>中的内容
weichenggao 2003-12-02
  • 打赏
  • 举报
回复
都说了这么多拉,建议楼主找本JSP的书看看,这样效果会好很多,你也会快速入门的!
jie015 2003-12-02
  • 打赏
  • 举报
回复
路过!
hojay2001 2003-12-02
  • 打赏
  • 举报
回复
在javaScript 里边的onClick也可以实现
在jsp 中<form action="*.jsp">
也可以
dugang106 2003-12-02
  • 打赏
  • 举报
回复
主要是触发提交事件
如果edit里边的回车可以相当于点击submit按钮,那肯定就能触发提交事件
当然前提是同一个form里面
即在<form></form>中
javascript:
formname.action=xxxxx;
formname.submit();
可以让你指定某个form
IvanGan 2003-12-02
  • 打赏
  • 举报
回复
建议你好好学学javascript,每个按钮都有click事件,form都有onsubmit()事件的属性,可以通过form中的type=submit 按钮提交form,也可以在javascript函数中通过form.submit()方法来提交,效果一样
xiaoer123 2003-12-02
  • 打赏
  • 举报
回复
也是在提交的时候,那么edit里边的回车是不是也能响应呢? 我现在是比较糊涂,最好能详细的说一下,呵呵请见谅~
passren 2003-12-02
  • 打赏
  • 举报
回复
在javascript里用

form.action=xxxxx;
form.submit();

也可以触发提交事件。
Leemaasn 2003-12-02
  • 打赏
  • 举报
回复
不用谢,帮你up
xiaoer123 2003-12-02
  • 打赏
  • 举报
回复
您是说在此段代码中加入吗?

这段代码是能够触发action的,我想知道它是怎么触发的
chenfei00 2003-12-02
  • 打赏
  • 举报
回复
onSubmit="alert ('表单提交中..')"
xiaoer123 2003-12-02
  • 打赏
  • 举报
回复
后边的这两句中我没有发现类似“submit”相关的东东~~,函数里边也没有

<input type="button" name="OkBn" value="确定" class="formbutton2" onClick="getreturn()">

<input type="button" name="CloseBn" value="关闭" class="formbutton2" onclick="window.returnValue=null;window.close();">
xiaoer123 2003-12-02
  • 打赏
  • 举报
回复
中间有些行太长就自动换行了~
xiaoer123 2003-12-02
  • 打赏
  • 举报
回复
那么请大家帮我看一看,这段代码里边的action是怎么触发的:

<html:html>
<script type="text/javascript" language="Javascript1.1">
<!--
function values(accountid,warnid,warnlevel,warndate,reason,result,active,canceldate,cancelemployee) {
this.accountid = accountid;
this.warnid = warnid;
this.warnlevel = warnlevel;
this.warndate = warndate;
this.reason = reason;
this.result= result;
this.active= active;
this.canceldate= canceldate;
this.cancelemployee= cancelemployee;

}

function getreturn() {
if(document.forms[0].warnlevel.value == "" ) {
alert("请输入级别");
return false;
}
if(document.forms[0].warndate.value == "" ) {
alert("请输入日期");
return false;
}
if(document.forms[0].reason.value == "" ) {
alert("请输入原因");
return false;
}

// 得到页面输入的值返回到lm_contactpersonlist.jsp
window.returnValue = new values(document.forms[0].accountid.value, document.forms[0].warnid.value, document.forms[0].warnlevel.value,document.forms[0].warndate.value, document.forms[0].reason.value, document.forms[0].result.value, document.forms[0].active.checked, document.forms[0].canceldate.value, document.forms[0].cancelemployee.value);
window.close();
}
-->
</script>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<META http-equiv="Expires" content="Tue, 20 Aug 1996 14:25:27 GMT">
<link rel="stylesheet" href="<%=request.getContextPath()%>/include/crmstyle.css">
<title>级别</title>
</head>
<body text="#000000" style="margin:0px;overflow:hidden;" bgcolor="#f4f4f4">
<!-- 信息表格区域-->
<table class="lineTable" id="Table2" cellspacing="0" cellpadding="0" height="100%" width="100%" >
<!-- Form begin-->
<html:form action="warnlist.do">
<tr>
<td background="<%=request.getContextPath()%>/image/xj.gif" class=dthtxt><img src="<%=request.getContextPath()%>/image/TA.gif" width="18" height="11">基本信息</td>
</tr>
<tr>
<td class="tdtable">
<table width="100%" border="0" cellspacing="0" cellpadding="0" >
<tr>
<td width="4px"><nobr>级别<font color="#FF0000">*</nobr></td>
<td width="30%"><html:sourcemanager property="warnlevel" sourcename="LCM006" isnull="1" style="width:100%" styleclass="txt3select"/></td>
<td width="4px"> </td>
<td width="4px"><nobr>日期<font color="#FF0000">*</nobr></td>
<td width="30%"><html:dateselect property="warndate" maxlength="40" style="width:100%" styleClass="stext" readonly="true"/></td>
<td width="4px"> </td>
<td width="4px%"> </td>
<td width="30%"> </td>
<td width="4px"> </td>
</tr>
<tr>
<td width="4px"><nobr>原因<font color="#FF0000">*</nobr></td>
<td colspan="7"><html:sourcemanager property="reason" sourcename="LCM017" isnull="1" style="width:100%" styleclass="txt3select"/></td>
<td width="4px"> </td>
</tr>
<tr>
<td width="4px"><nobr>结果</nobr></td>
<td colspan="7"><html:textarea property="result" maxlength="1000" styleclass="stextarea" style="width:100%"/></td>
<td width="4px"> </td>
</tr>
<tr>
<td align="RIGHT"><html:checkbox property="active"/></td>
<td width="30%" align="LEFT"><nobr>解除</nobr></td>
<td width="4px"> </td>
<td width="4px"><nobr>解除日期</nobr></td>
<td width="30%"><html:dateselect property="canceldate" maxlength="40" style="width:100%" styleClass="stext" readonly="true"/></td>
<td width="4px"> </td>
<td width="4px"><nobr>解除人</nobr></td>
<td width="4px"> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="center">
<html:hidden property="type"/>
<html:hidden property="accountid"/>
<html:hidden property="warnid"/>
<input type="button" name="OkBn" value="确定" class="formbutton2" onClick="getreturn()">
<input type="button" name="CloseBn" value="关闭" class="formbutton2" onclick="window.returnValue=null;window.close();">
<!--按完按钮,回到显示页面warnlist.jsp-->
</td>
</tr>

</html:form>
<!-- Form end off-->
</table>
<!-- 信息表格区域结束-->
</body>
</html:html>

81,092

社区成员

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

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