FF下,方向键可以使body滚动的问题 本帖最后由 ohnojack 于 2011-12-08 11:19:57 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你可以这么做,但是你用鼠标选择的时候还是可以下去的,IE,chrome,ff都是<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body style='overflow:hidden'><div style='width:900px;height:1200px;background-color:#555555;position:absolute'><span style='left:100px;top:100px;width:100px;height:100px;foreground-color:#DDDDDD;position:absolute'>hello</span></div></body><script>document.onkeypress = function(event){ if(37<=event.keyCode<=40){ event.preventDefault(); }}</script></html> to p2227 谢谢你的回答,不知道是否还有其他属性可以直接设置。 <!DOCTYPE html><html><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Insert title here</title></head><body> <div id="container"> <div style='width:900px;height:1200px;background-color:#555555;'> <span style='left:100px;top:100px;width:100px;height:100px;foreground-color:#DDDDDD;'>hello</span> </div> </div> <script> window.onload = function(){ var div = document.getElementById('container'); div.style.height = document.documentElement.clientHeight - 16 + "px"; div.style.overflow = "hidden"; } </script></body></html> to axiheyhey :这个处理很好,就是需要在body下多加个div了 To p2227:preventDefault这样处理不太友好,应用中需要方向键的地方较多。不知道还有没有更好地法子。 JY游戏开发,案例之 《下到一百层》,欢迎大家品赏。 jquery判断是否选中单选按钮的问题,请前辈们给看看 javascript提取url参数难题,高分请帮忙 JS冒泡问题【代码很少】 求高人帮我改动一下JS,只差最后一步了 帮我修改一下这个截至日期代码-代码很短的 请教高手!走过路过的进来看看! 50分求event.srcElement.parentElement在此代码中如何使用? 请教一个小问题!很急,谢谢!! 怎么做一个简单的单页 显示这段JS代码、 一个jQuery问题答对给分不够加分谢谢了! 【textarea】 JS来判断这里面的最大输入字符数量
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body style='overflow:hidden'>
<div style='width:900px;height:1200px;background-color:#555555;position:absolute'>
<span style='left:100px;top:100px;width:100px;height:100px;foreground-color:#DDDDDD;position:absolute'>hello</span>
</div>
</body>
<script>
document.onkeypress = function(event){
if(37<=event.keyCode<=40){
event.preventDefault();
}
}
</script>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
<div id="container">
<div style='width:900px;height:1200px;background-color:#555555;'>
<span style='left:100px;top:100px;width:100px;height:100px;foreground-color:#DDDDDD;'>hello</span>
</div>
</div>
<script>
window.onload = function(){
var div = document.getElementById('container');
div.style.height = document.documentElement.clientHeight - 16 + "px";
div.style.overflow = "hidden";
}
</script>
</body>
</html>
不知道还有没有更好地法子。