大家帮我看看这个简单的javaScript,为什么点击按钮后没有反应?

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>带滚动条的广告图片</title>
<style type="text/css">
#main{text-align:center; background-color:#930; height:600px; width:800px}
</style>
<script type="text/javascript">
function test(id){
var obj=document.getElementById(id);
alert("left="+obj.style.left+";top="+obj.style.top);
obj.style.left=parseInt(obj.style.left)+20+"px";
obj.style.top=parseInt(obj.style.top)+20+"px";
}
</script>
</head>
<body>
<div id="testDiv" style="position:absolute; left:300px; top:60px; background-color:#F00; width:80px; height:200px;">内部样式Div</div>
<input type="button" value="坐标测试" onclick="test('testDiv');" />
<div id="main">显示内容</div>
</body>

经测试,chrome,火狐浏览器和IE8浏览器,都能运行,都有反应。会不会是你测试的浏览器和版本有问题呢,换前面的三款浏览器,就没问题了哈
温馨提示:内容为网友见解,仅供参考
第1个回答  2012-09-14
LZ在开玩笑吧,我测试了8个浏览器,都有反应,难倒你禁止了脚本运行?
第2个回答  2012-09-14
经chrome测试按钮点击有反应
第3个回答  2012-09-14
路过……
相似回答
大家正在搜