老师,我用Dreamweaver
写,写一模一样都不出效果,为什么呢?难道用Dreamweaver要用不同的写法吗?
不是的。。一样的,看看你的代码?
<!doctype html>
<html>
<head>
<script src="scripts/jquery.js"></script>
<meta charset="utf-8">
<title>无标题文档</title>
<link href="style/reset.css" rel="stylesheet" type="text/css">
<link href="style/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="container">
<img src="images/m0.jpg" alt="1008花" title="1008花">
<img src="images/m1.jpg" alt="1005地" title="1005地">
<img src="images/m2.jpg" alt="1008然" title="1008然">
<img src="images/m3.jpg" alt="1008企" title="1008企">
</div>
<script>
function(){
var box= document.getElementById("container");
var imgs= box.getElementsByTagName("img");
var imgWidth = imgs[0].offsetWidth;
var exposeWidth = 300;
var boxWidth = imgWidth+(imgs.length-1)*exposeWidth;
box.style.width = boxWidth+"px";
}
for (var i =1,len = imgs.length;i<len;i++){
imgs[i].style.left = imgWidth + exposeWidth*(i-1)+"px";
}
</script>
</body>
</html>