日期:2014-05-18  浏览次数:20682 次

在jsp登陆界面中,怎样得到屏幕的高度、宽度,再把他传到下一个页面中~~急~~~~
我在javaScript中定义了
var   height=window.screen.height;
var   width=window.screen.width;

------解决方案--------------------
<script>
function test() {
document.forms[0].screenheight.value = window.screen.height;
document.forms[0].screenwidth.value = window.screen.width;
}
</script>
<body onload= "test() ">
<form action= "upscreen.do ">
<input type= "hidden " id= "screenheight " value= " ">
<input type= "hidden " id= "screenwidth " value= " ">
</form>

大概就这样提交
------解决方案--------------------
function test() {
window.open (文件名.jsp?height=高度&width=宽度);
}

只是写的伪代码 注意一下js的格式,别的没什么

其实方法有好多

或者是你在提交时设一个action,写个专门给input赋值的语句
document.forms[0].screenheight.value = window.screen.height;

最后再用document.form.submit();提交


------解决方案--------------------
把value取掉看看 <input type= "hidden " id= "screenheight ">

------解决方案--------------------
<input type= "hidden " id= "screenheight " value= " ">
<input type= "hidden " id= "screenwidth " value= " ">
改成
<input type= "hidden " name= "screenheight " value= " ">
<input type= "hidden " name= "screenwidth " value= " ">

传的值只能收到name,id收不到.

------解决方案--------------------
学习了一下,觉的zhuxr2003()才说到点子上了~~