当前位置:编程学习 > JSP >>

在jsp中没有form表单的情况下怎么,能通过点击button按钮触发js方法 获得text的内容?

代码如下: 没有form的情况下。 <input type="text" name="tee" /> <input type="button" onclick="ee()"> 怎样写 javascript中的方法 ,实现获得text的值。同时实现在ee方法中跳转到001.html; 求解。谢谢。
答案:节点修改:<input  type="text"  name="tee" id="tee" />
函数实现:
function ee(){
var sVal = document.getElementById('tee').value;
alert(sVal);
window.location = '001.html';
}
其他:js里面使用ajax,调用后台的java程序,然后java程序里面设置respose的网页就行了。 <script> 
  function ee(){
 
  var  ttt=document.getElementById("tee").value;//取值tee 为 input id
window.location.href="001.html";//跳转
   </script>
<input  type="text"  name="tee" id="tee"/> function ee(){

var textValue=document.getElementById(" ni yao qu de dui xiang de id ").value.trim();
alert(textValue);
window.location.href="XXX.html"
} 

上一个:js如何调用jsp数组变量,在线等,急!
下一个:求助JSP,select配置JSTL ,怎么引入标签库?还有能简单说说指令跳转吗?.....谢谢....急急急

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,