请大家帮我看看.累死我了.奋斗了10多个小时了.头都快爆炸了.检查了一个多小时了.还是不知道哪里出错了.
好心的朋友们帮下忙..希望醒来能有满意的答复.我敢肯定是slideshow()函数里出问题了.
睡觉去了.
<html>
<head>
<style type="text/css">
*{margin:0;padding:0;}
ul{list-style:none outside none;}
img{border:none;display:block;}
a{text-decoration:none;}
#navigation{
width:500px;
margin:33px auto;
border:1px solid orange;
overflow:hidden;
height:680px;
}
#naviContent{
width:220px;
float:right;
}
#naviContent li{
width:220px;
height:44px;
display:block;
float:left;
clear:both;
overflow:hidden;
border-bottom:1px solid #ccc;
}
#naviContent span{
display:block;
width:200px;
text-align:center;
font-size:13px;
line-height:20px;
color:#838684;
}
#naviContent span strong{
color:#4a4c4a;
}
#naviImage{
width:270px;
border:1px solid red;
height:680px;
overflow:hidden;
position:relative;
}
#image_1{
background:blue;
width:270px;
height:180px;
}
#image_2{
background:yellow;
width:270px;
height:180px;
}
#image_3{
background:red;
width:270px;
height:180px;
}
#image_4{
background:green;
width:270px;
height:180px;
}
</style>
<script type="text/javascript">
function moveMessage(elementID,final_x,final_y,interval){
var elem = document.getElementById(elementID);
if(elem.movement){
clearTimeout(elem.movement);
}
var xpos = parseInt(elem.style.left);
var ypos = parseInt(elem.style.top);
if(xpos == final_x && ypos == final_y){
return true;
}
if(xpos < final_x){
var dist = Math.ceil((final_x - xpos)/10);
xpos = xpos + dist;
}
if(xpos > final_x){
var dist = Math.ceil((xpos - final_x)/10);
xpos = xpos - dist;
}
if(ypos < final_y){
var dist = Math.ceil((final_y - ypos)/10);
ypos = ypos + dist;
}
if(ypos > final_y){
var dist = Math.ceil((ypos - final_y)/10);
ypos = ypos - dist;
}
elem.style.left = xpos + "px";
elem.style.top = ypos + "px";
var repeat = "moveMessage('"+elementID+"',"+final_x+","+final_y+","+interval+")";
elem.movement = setTimeout(repeat,interval)
}
function slideshow(){
for(var i=1; i<4; i++){
var slideshow = document.getElementById("image_"+i);
slideshow.style.position = "absolute";
slideshow.style.left = "0px";
slideshow.style.top = "0px";
var list = document.getElementById("list");
var links = list.getElementsByTagName("a");
links[0].onmouseover = function(){
moveMessage("image_1",0,0,10);
}
links[1].onmouseover = function(){
moveMessage("image_2",270,0,10);
}
links[2].onmouseover = function(){
moveMessage("image_3",540,0,10);
}
links[3].onmouseover = function(){
moveMessage("image_4",-820,0,10);
}
}
}
window.onload = slideshow;
</script>
</head>
<body>
<div id="navigation">
<div id="naviContent">
<ul id="list">
<li><a href=""><span><strong>蓝色</strong></span><span>这是蓝色ss!</span></a></li>
<li><a href=""><span><strong>黄色</strong></span><span>这是黄色!</span></a></li>
<li><a href=""><span><strong>红色</strong></span><span>这是红色!</span></a></li>
<li><a href=""><span><strong>绿色</strong></span><span>这是绿色!</span></a></li>
</ul>
</div>
<div id="naviImage">
<a href=""><img src="images/blue.gif" id="image_1" /></a>
<a href=""><img src="images/yellow.gif" id="image_2" /></a>
<a href=""><img src="images/red.gif" id="image_3" /></a>
<a href=""><img src="images/green.gif" id="image_4" /></a>
</div>
</div>
</body>
</html>
好心的朋友们帮下忙..希望醒来能有满意的答复.我敢肯定是slideshow()函数里出问题了.
睡觉去了.
<html>
<head>
<style type="text/css">
*{margin:0;padding:0;}
ul{list-style:none outside none;}
img{border:none;display:block;}
a{text-decoration:none;}
#navigation{
width:500px;
margin:33px auto;
border:1px solid orange;
overflow:hidden;
height:680px;
}
#naviContent{
width:220px;
float:right;
}
#naviContent li{
width:220px;
height:44px;
display:block;
float:left;
clear:both;
overflow:hidden;
border-bottom:1px solid #ccc;
}
#naviContent span{
display:block;
width:200px;
text-align:center;
font-size:13px;
line-height:20px;
color:#838684;
}
#naviContent span strong{
color:#4a4c4a;
}
#naviImage{
width:270px;
border:1px solid red;
height:680px;
overflow:hidden;
position:relative;
}
#image_1{
background:blue;
width:270px;
height:180px;
}
#image_2{
background:yellow;
width:270px;
height:180px;
}
#image_3{
background:red;
width:270px;
height:180px;
}
#image_4{
background:green;
width:270px;
height:180px;
}
</style>
<script type="text/javascript">
function moveMessage(elementID,final_x,final_y,interval){
var elem = document.getElementById(elementID);
if(elem.movement){
clearTimeout(elem.movement);
}
var xpos = parseInt(elem.style.left);
var ypos = parseInt(elem.style.top);
if(xpos == final_x && ypos == final_y){
return true;
}
if(xpos < final_x){
var dist = Math.ceil((final_x - xpos)/10);
xpos = xpos + dist;
}
if(xpos > final_x){
var dist = Math.ceil((xpos - final_x)/10);
xpos = xpos - dist;
}
if(ypos < final_y){
var dist = Math.ceil((final_y - ypos)/10);
ypos = ypos + dist;
}
if(ypos > final_y){
var dist = Math.ceil((ypos - final_y)/10);
ypos = ypos - dist;
}
elem.style.left = xpos + "px";
elem.style.top = ypos + "px";
var repeat = "moveMessage('"+elementID+"',"+final_x+","+final_y+","+interval+")";
elem.movement = setTimeout(repeat,interval)
}
function slideshow(){
for(var i=1; i<4; i++){
var slideshow = document.getElementById("image_"+i);
slideshow.style.position = "absolute";
slideshow.style.left = "0px";
slideshow.style.top = "0px";
var list = document.getElementById("list");
var links = list.getElementsByTagName("a");
links[0].onmouseover = function(){
moveMessage("image_1",0,0,10);
}
links[1].onmouseover = function(){
moveMessage("image_2",270,0,10);
}
links[2].onmouseover = function(){
moveMessage("image_3",540,0,10);
}
links[3].onmouseover = function(){
moveMessage("image_4",-820,0,10);
}
}
}
window.onload = slideshow;
</script>
</head>
<body>
<div id="navigation">
<div id="naviContent">
<ul id="list">
<li><a href=""><span><strong>蓝色</strong></span><span>这是蓝色ss!</span></a></li>
<li><a href=""><span><strong>黄色</strong></span><span>这是黄色!</span></a></li>
<li><a href=""><span><strong>红色</strong></span><span>这是红色!</span></a></li>
<li><a href=""><span><strong>绿色</strong></span><span>这是绿色!</span></a></li>
</ul>
</div>
<div id="naviImage">
<a href=""><img src="images/blue.gif" id="image_1" /></a>
<a href=""><img src="images/yellow.gif" id="image_2" /></a>
<a href=""><img src="images/red.gif" id="image_3" /></a>
<a href=""><img src="images/green.gif" id="image_4" /></a>
</div>
</div>
</body>
</html>
解决方案 »
- 关于标签栏chrome浏览器中的设置
- 请问如何调用webservice等api的?
- 这个哪里错了呢?点“我的”放到input里面去
- JavaScript版蜘蛛纸牌实现的问题
- FF 和IE 显示body.clientheight 等属性的区别,求教
- 在网页上如何调整单行编辑框的高度?请不吝赐教!!!
- xloadtree.js中,xmlDoc在loadXML后,xmlDoc为null,为什么啊?
- 紧急求助!!!如何去掉窗口中的最大最小化按扭???在线等待!
- 请教如何“打印预览”不同框架页里的页面呢?
- ####关于一个日历控件的问题####
- 其实一直到现在,我不知道怎么学jQuery
- 为何我访问不了父页面的父页面?
你的方法太纠结了,滑动<div id="naviImage">这个DIV块就好了