首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

在jsp登陆界面中,怎样得到屏幕的高度、宽度,再把他传到下一个页面中~该怎么处理

2012-02-29 
在jsp登陆界面中,怎样得到屏幕的高度、宽度,再把他传到下一个页面中~~急~~~~我在javaScript中定义了varheig

在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()才说到点子上了~~

热点排行