<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2"/>
<title>Untitled Document</title>
<style type="text/css">
#logo1 {
left:100px;
top:200px;
width: 52px;
height: 37px;
background: url(http://www.zzsky.cn/effect/images/2008901080950.gif) 0px 0px;
}
#logo2{
left:100px;
top:300px;
width: 52px;
height: 37px;
background: url(http://www.zzsky.cn/effect/images/2008901080950.gif) 0px 37px;
}
</style>
<script type="text/javascript">
function dsp(o,n, playing){
if (n <= 6 && n >= 0) {
var button = document.getElementById("o");
var width = 52;
var offsetWidth = -width * n;
button.style.backgroundPosition = offsetWidth + "px 37px";
n = playing ? n + 1 : n - 1;
setTimeout("dsp("+ o +"" + n + "," + playing + ")", 45);
}
}
</script>
</head>
<body>
<div id="logo1" onmouseover="dsp("logo1",1, true);" onmouseout="dsp("logo1",6);"> </div>
<div id="logo2" onmouseover="dsp("logo2",1, true);" onmouseout="dsp("logo2",6);"> </div>
</body>
</html>
高手帮忙下,总报LOGO1,LOGO2没定义
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2"/>
<title>Untitled Document</title>
<style type="text/css">
#logo1 {
left:100px;
top:200px;
width: 52px;
height: 37px;
background: url(http://www.zzsky.cn/effect/images/2008901080950.gif) 0px 0px;
}
#logo2{
left:100px;
top:300px;
width: 52px;
height: 37px;
background: url(http://www.zzsky.cn/effect/images/2008901080950.gif) 0px 37px;
}
</style>
<script type="text/javascript">
function dsp(o,n, playing){
if (n <= 6 && n >= 0) {
var button = document.getElementById("o");
var width = 52;
var offsetWidth = -width * n;
button.style.backgroundPosition = offsetWidth + "px 37px";
n = playing ? n + 1 : n - 1;
setTimeout("dsp("+ o +"" + n + "," + playing + ")", 45);
}
}
</script>
</head>
<body>
<div id="logo1" onmouseover="dsp("logo1",1, true);" onmouseout="dsp("logo1",6);"> </div>
<div id="logo2" onmouseover="dsp("logo2",1, true);" onmouseout="dsp("logo2",6);"> </div>
</body>
</html>
高手帮忙下,总报LOGO1,LOGO2没定义
2.改var button = document.getElementById(o);
3.改 setTimeout("dsp('"+ o +"'," + n + "," + playing + ")", 45);
以下代码运行通过<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2"/>
<title>Untitled Document </title>
<style type="text/css">
#logo1 {
left:100px;
top:200px;
width: 52px;
height: 37px;
background: url(http://www.zzsky.cn/effect/images/2008901080950.gif) 0px 0px;
}
#logo2{
left:100px;
top:300px;
width: 52px;
height: 37px;
background: url(http://www.zzsky.cn/effect/images/2008901080950.gif) 0px 37px;
}
</style>
<script type="text/javascript">
function dsp(o,n, playing){
if (n <= 6 && n >= 0) {
var button = document.getElementById(o);
var width = 52;
var offsetWidth = -width * n;
button.style.backgroundPosition = offsetWidth + "px 37px";
n = playing ? n + 1 : n - 1;
setTimeout("dsp('"+ o +"'," + n + "," + playing + ")", 45);
}
}
</script>
</head>
<body>
<div id="logo1" onmouseover="dsp('logo1',1, true);" onmouseout="dsp('logo1',6,false);"> </div>
<div id="logo2" onmouseover="dsp('logo2',1, true);" onmouseout="dsp('logo2',6,false);"> </div>
</body>
</html>