页面间数值传递问题
时间:2011-08-20
来源:互联网
在第一个页面中通过下拉框选择一个类别:
<select name="select1" id="select1">
<option value="1" id="name" selected="selected">书名</option>
<option value="2" id="author">作者</option>
<option value="3" id="publisher">出版社</option>
<option value="4" id="ISBN">ISBN</option>
</select>
在另一个页面中调用在第一个页面中所选择的类别:
String select2=document.getElementById(request.getParameter("select1"));
调不出来啊,问题出在哪里?
<select name="select1" id="select1">
<option value="1" id="name" selected="selected">书名</option>
<option value="2" id="author">作者</option>
<option value="3" id="publisher">出版社</option>
<option value="4" id="ISBN">ISBN</option>
</select>
在另一个页面中调用在第一个页面中所选择的类别:
String select2=document.getElementById(request.getParameter("select1"));
调不出来啊,问题出在哪里?
作者: jiaojiao_huihui 发布时间: 2011-08-20
String select2=document.getElementById(request.getParameter("select1"));
你知道这句话的意思不?
==String select2=document.getElementById("1");
你知道这句话的意思不?
==String select2=document.getElementById("1");
作者: cbxjj 发布时间: 2011-08-20
第一个页面那是一个表单吗?如果是提交到action,能获取到吗?如果能获取到,在第二个页面能显示这个值吗?如果能显示,你这句话到底是想用js获取值,还是在action获取值:String select2=document.getElementById(request.getParameter("select1"));,我晕。
在后台获取:
String select2 = request.getParameter("select1");
用js获取,你就要把这个获取到的值设在第二个页面上。然后再用js获取:
如<div id="select2">${select1}</div>
var select2 = document.getElementById("select2").innerHTML;
在后台获取:
String select2 = request.getParameter("select1");
用js获取,你就要把这个获取到的值设在第二个页面上。然后再用js获取:
如<div id="select2">${select1}</div>
var select2 = document.getElementById("select2").innerHTML;
作者: huxiweng 发布时间: 2011-08-20
引用 2 楼 huxiweng 的回复:
在后台获取:
String select2 = request.getParameter("select1");
在后台获取:
String select2 = request.getParameter("select1");
在后面加上
out.println(select2);
显示的结果为null,说明调用不成功啊,为什么呢?
作者: jiaojiao_huihui 发布时间: 2011-08-20
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28