在JavaScript中,页面之间如何传值
发布网友
发布时间:2023-12-05 19:47
我来回答
共1个回答
热心网友
时间:2024-05-10 14:04
可以利用form表单提交获取上一个页面的值
例:form表单提交传值及取值
发请求页面
1
2
3
4
5
6
7
<form style="display: none" method="post"
id="infoDetailsHyperlink" name="input"
action="<%=request.getContextPath()%>/view/basicmanage/reportTemplet/positionPeopleConfig.jsp">
<input name="infoId" id="infoId">
<input name="operationType" id="operationType">
<input name="copyTempletIdConfigPeople" id="copyTempletIdConfigPeople">
</form>
发请求页面,js中发送请求
1
2
3
$("#infoId").val($("#lastStepTempletId").val());
$("#operationType").val($("#operationTypeIdLastStep").val());
$("#infoDetailsHyperlink").submit();
接收页面
1
2
3
4
5
6
<input id="infoId" style="display: none;" value=<%=request.getParameter("infoId")%>>
<input id="operationType" style="display: none;" value=<%=request.getParameter("operationType")%>>
<input id="copyTempletIdConfigPeople" style="display: none;" value=<%=request.getParameter("copyTempletIdConfigPeople")%>>
<script>
<%request.setCharacterEncoding("utf-8");%> 解决传值时中文乱码问题
</script>
热心网友
时间:2024-05-10 14:04
可以利用form表单提交获取上一个页面的值
例:form表单提交传值及取值
发请求页面
1
2
3
4
5
6
7
<form style="display: none" method="post"
id="infoDetailsHyperlink" name="input"
action="<%=request.getContextPath()%>/view/basicmanage/reportTemplet/positionPeopleConfig.jsp">
<input name="infoId" id="infoId">
<input name="operationType" id="operationType">
<input name="copyTempletIdConfigPeople" id="copyTempletIdConfigPeople">
</form>
发请求页面,js中发送请求
1
2
3
$("#infoId").val($("#lastStepTempletId").val());
$("#operationType").val($("#operationTypeIdLastStep").val());
$("#infoDetailsHyperlink").submit();
接收页面
1
2
3
4
5
6
<input id="infoId" style="display: none;" value=<%=request.getParameter("infoId")%>>
<input id="operationType" style="display: none;" value=<%=request.getParameter("operationType")%>>
<input id="copyTempletIdConfigPeople" style="display: none;" value=<%=request.getParameter("copyTempletIdConfigPeople")%>>
<script>
<%request.setCharacterEncoding("utf-8");%> 解决传值时中文乱码问题
</script>
热心网友
时间:2024-05-10 14:07
可以利用form表单提交获取上一个页面的值
例:form表单提交传值及取值
发请求页面
1
2
3
4
5
6
7
<form style="display: none" method="post"
id="infoDetailsHyperlink" name="input"
action="<%=request.getContextPath()%>/view/basicmanage/reportTemplet/positionPeopleConfig.jsp">
<input name="infoId" id="infoId">
<input name="operationType" id="operationType">
<input name="copyTempletIdConfigPeople" id="copyTempletIdConfigPeople">
</form>
发请求页面,js中发送请求
1
2
3
$("#infoId").val($("#lastStepTempletId").val());
$("#operationType").val($("#operationTypeIdLastStep").val());
$("#infoDetailsHyperlink").submit();
接收页面
1
2
3
4
5
6
<input id="infoId" style="display: none;" value=<%=request.getParameter("infoId")%>>
<input id="operationType" style="display: none;" value=<%=request.getParameter("operationType")%>>
<input id="copyTempletIdConfigPeople" style="display: none;" value=<%=request.getParameter("copyTempletIdConfigPeople")%>>
<script>
<%request.setCharacterEncoding("utf-8");%> 解决传值时中文乱码问题
</script>
热心网友
时间:2024-05-10 14:07
可以利用form表单提交获取上一个页面的值
例:form表单提交传值及取值
发请求页面
1
2
3
4
5
6
7
<form style="display: none" method="post"
id="infoDetailsHyperlink" name="input"
action="<%=request.getContextPath()%>/view/basicmanage/reportTemplet/positionPeopleConfig.jsp">
<input name="infoId" id="infoId">
<input name="operationType" id="operationType">
<input name="copyTempletIdConfigPeople" id="copyTempletIdConfigPeople">
</form>
发请求页面,js中发送请求
1
2
3
$("#infoId").val($("#lastStepTempletId").val());
$("#operationType").val($("#operationTypeIdLastStep").val());
$("#infoDetailsHyperlink").submit();
接收页面
1
2
3
4
5
6
<input id="infoId" style="display: none;" value=<%=request.getParameter("infoId")%>>
<input id="operationType" style="display: none;" value=<%=request.getParameter("operationType")%>>
<input id="copyTempletIdConfigPeople" style="display: none;" value=<%=request.getParameter("copyTempletIdConfigPeople")%>>
<script>
<%request.setCharacterEncoding("utf-8");%> 解决传值时中文乱码问题
</script>