document.form.command.value

问题:在一个JSP页面中需要多个提交按钮,每个按钮点击后需要把同一个form提交到不同的页面进行处理

解决:用JS。

<html>
<head>
<title>一个表单、多个提交按钮、提交到多个不同页面</title>
</head>

<script>
function sm1(){
   document.getElementByIdx("form1").action="1.jsp";
   document.getElementByIdx("form1").submit();
}
function sm2(){
   document.getElementByIdx("form1").action="2.jsp";
   document.getElementByIdx("form1").submit();
}
</script>

<body>
<form action="" method="post" id="form1">
 <input name="mytext" type="text" id="mytext" />
 <input name="bt1" type="button" id="bt1" value="提交到1.jsp" onclick="sm1()" />
 <input name="bt2" type="button" id="bt2" value="提交到2.jsp" onclick="sm2()" />
</form>
</body>
</html>

时间: 2024-08-11 03:33:08

document.form.command.value的相关文章

js提交表单错误:document.form.submit() is not a function

今天在写JS时,遇上这么个错误:"document.form.submit() is not a function",经过一番搜索,最终找到了修复方法. 这个错误一般是由于表单<form>-</form>中含有name="submit"时,提交时就会有冲突,这个错误常见于按钮上,如: 在Javascript做submit()的时候就会出现冲突,这时将name="submit"改成别的名字就可以了:即使不是按钮,在表单的输入

不通过getElementByName实现获取表单数据 (document.form表单的name值.input输入框的name值)

function update() { //document.form表单的name值.input输入框的name值 var username = document.form1.username; var mobile = document.form1.mobile; var qq = document.form1.qq; } <form name="form1" method="post" action=""> <table

【转】document.form.action,表单分向提交

document.form.action,表单分向提交,javascript提交表单 同一个表单可以根据用户的选择,提交给不同的后台处理程序.即,表单的分向提交.如,在编写论坛程序时,如果我们希望实现用户在发送贴子的时候,既发送提交功能又有预览功能时,就会遇到上述问题.即,当用户点击提交按钮时,我们希望表单提交给"提交"处理程序:而当用户点击预览按钮时,我们希望表单提交给"预览"处理程序.那么,如何实现上述功能呢?下面代码可以很好的解决这个问题. <form

form表单的name作用

表单的name作用:name 属性用于对提交到服务器后的表单数据进行标识 注意:只有设置了 name 属性的表单元素才能在提交表单时传递它们的值. 简单来说,name就是提交到后台的索引,比如在复选框中都要设置成name="hobby"说明几个复选框都在爱好下. (1)name如何分组: 具有相同name属性radio为同一组 <lable>性别</lable> <input type="radio" name="sex&qu

html中隐藏域hidden

基本语法: <input type="hidden" name="field_name" value="value"> 作用: 1 隐藏域在页面中对于用户是不可见的,在表单中插入隐藏域的目的在于收集或发送信息,以利于被处理表单的程序所使用.浏览者单击发送按钮发送表单的时候,隐藏域的信息也被一起发送到服务器. 2 有些时候我们要给用户一信息,让他在提交表单时提交上来以确定用户身份,如sessionkey,等等.当然这些东西也能用cook

input:hidden的作用

隐藏域在页面中对于用户是不可见的,在表单中插入隐藏域的目的在于收集或发送信息,以利于被处理表单的程序所使用 (隐藏只是在网页页面上面不显示输入框,但是虽然隐藏了,还是具有form传值功能. 一般用来传值,而不必让用户看到.) 基本语法: <input type="hidden" name="field_name" value="value"> 作用: 1 隐藏域在页面中对于用户是不可见的,在表单中插入隐藏域的目的在于收集或发送信息,以

arcmap Command

The information in this document is useful if you are trying to programmatically find a built-in command, menu, or toolbar. The ICommandBars::Find and ICommandBar::Find methods can be used to get a reference to a specific toolbar, menu, or command. B

Meandering Through the Maze of MFC Message and Command Routing

Meandering Through the Maze of MFC Message and Command Routing Paul DiLascia Paul DiLascia is a freelance software consultant specializing in developing C++ applications for Windows. He is the author of Windows++: Writing Reusable Code in C++ (Addiso

Document节点

原文地址:https://wangdoc.com/javascript/ 概述 document对象. window.document属性就指向这个对象.只要浏览器开始载入HTML文档,该对象就存在了,可以直接使用. document对象有不同的办法可以获取. 正常的网页,直接使用document或window.document iframe框架里面的网页,使用iframe节点的contentDocument属性. Ajax操作返回的文档,使用XMLHttpRequest对象的responseX