编程论坛's Archiver

kenshin256 发表于 2008-5-7 12:53

请教一个小的javascript程序问题

我想做一个层响应鼠标的单击,而向右移动的小程序
可怎么也实践不出来.请大家帮帮忙,帮我看一下.谢谢啦
<!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=gb2312" />
<title>无标题文档</title>
<script type="text/javascript">
function move(){
  var p = document.getElementById('Layer1');
  p.style.left += 25;
  return true;
}
</script>
</head>

<body>
<div id="Layer1" style="position:absolute; width:100px; height:100px; background-color:#00FFFF;"></div>
<p style="height:200px;"></p>
<input type="button" value="Begin"  onclick="move()"/>
</body>
</html>

hwoarangzk 发表于 2008-5-7 13:48

p.style.left += 25 + 'px';

tidus 发表于 2008-5-7 14:41

*** 作者被禁止或删除 内容自动屏蔽 ***

kevintang 发表于 2008-5-7 14:42

顶!学习了!

页: [1]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.