overflow:hidden

firstblood_dota 2009-07-08 10:44:55
一直摁住右方向,及下方向键后,DIV会滚出屏幕范围(在IE,SAFARI,GOOGLE浏览器上都正常),在FF和OPERA上,overflow的hidden和visible差不多,就是hidden隐藏了滚动条而已,而DIV没有滚出屏幕。

望大虾帮忙解决,谢

<!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="imagetoolbar" CONTENT="no">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
html{
overflow:hidden;
}
</style>
</head>

<body>
<div id="test" style=' position:absolute; left:0px;top:0px; background-color:#666666; width:400px; height:400px;'>
</div>
<script type="text/javascript" charset="utf-8">

document.onkeydown= function(e){
e=e||window.event;
ek=e.keyCode||e.which;
var da = document.getElementById("test"),daol = da.offsetLeft,daot = da.offsetTop|0;
switch(ek){
case 37:da.style.left=daol-5+"px";break;
case 39:da.style.left=daol+5+"px";break;
case 38:da.style.top=daot-5+"px";break;
case 40:da.style.top=daot+5+"px";break;
default:break;
}
}
</script>

</body>
</html>

...全文
38 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
firstblood_dota 2009-07-08
  • 打赏
  • 举报
回复
高手救命啊,抽点时间帮我想想吧
firstblood_dota 2009-07-08
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 Free_Wind22 的回复:]
感觉是有点奇怪,用da.style.left取左边,然后把数字调到50后可以按出去。


楼主打DOTA是不是经常送一血啊... - -!
[/Quote]

调50就太快了,郁闷死了,这些浏览器细节上差别很多
firstblood_dota 2009-07-08
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 Free_Wind22 的回复:]
感觉是有点奇怪,用da.style.left取左边,然后把数字调到50后可以按出去。


楼主打DOTA是不是经常送一血啊... - -!
[/Quote]

我DOTA挺不错的,所以导致编程基础就很差,呵呵,
刚开始学WEB开发
2009-07-08
  • 打赏
  • 举报
回复
感觉是有点奇怪,用da.style.left取左边,然后把数字调到50后可以按出去。



楼主打DOTA是不是经常送一血啊... - -!
eugenepada 2009-07-08
  • 打赏
  • 举报
回复
overflow Property
hidden
This value indicates that the content is clipped and that no scrolling user interface should be provided to view the content outside the clipping region.

Setting 'overflow' to 'hidden' for the <div>, on the other hand, causes the <blockquote> to be clipped by the containing block:


firstblood_dota 2009-07-08
  • 打赏
  • 举报
回复
up
firstblood_dota 2009-07-08
  • 打赏
  • 举报
回复
顶!!!!1
wangfangfang_wff 2009-07-08
  • 打赏
  • 举报
回复
帮你顶

87,901

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧