实现下面效果! 实现如下效果页面加载的时候图片从左边第一个开始加载(一直到右边最下面一个,循环的)在中间的大图中显示鼠标画上去的就在中间的那个图中显示该图片 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://www.lanrentuku.com/down/js/jiaodiantu-648/这个,可以下载 这个是带有flash的你的那个框架是flash做的不行纯JS 现在就要你用editplus写再次感谢不然的话不会晚上发帖 我来实现一个。<style type="text/css">div{ margin-top:10px;}</style><script type="text/jscript">window.onload = function(){ for(var i = 1; i <= 6; i++){ var img = document.createElement('img'); img.src = "" + i + ".jpg"; img.height = 50; img.width = 100; var div = document.getElementById('div' + i); div.appendChild(img); img.onclick = function(){ var mainDiv = document.getElementById('MainDiv'); mainDiv.firstChild.src = this.src; } } var mainDiv = document.getElementById('MainDiv'); var image = document.createElement('img'); image.src = "1.jpg"; image.height = 100; image.width = 200; mainDiv.appendChild(image); }</script><div><div style="float:left; width:100px;"><div id="div1"></div><div id="div2"></div><div id="div3"></div></div><div style="float:left; width:200px; padding:50px;" id="MainDiv"></div><div style="float:left; width:100px;"><div id="div4"></div><div id="div5"></div><div id="div6"></div></div></div> 对应的图片分别是1.JPG,2.JPG,3.JPG,4.JPG,5.JPG,6.JPG。接分了。 看看<!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> <title>test page</title> <style type="text/css"> body { font-size:12px; } table img{ border:solid 1px #09f; } .cur { border:solid 1px #ff0000; } </style></head><body><div> <div id="div1"> </div></div></body><!--<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>--><script type="text/javascript">var g=function(s) { return typeof(s)=="string"?document.getElementById(s):s;}var getByAtt=function(att,val,doc) { doc=doc || document; var docs=doc.getElementsByTagName("*"); for(var i=0,els=[];i<docs.length;i++) { if(docs[i].getAttribute(att)==val) { els.push(docs[i]); } } return els;}var imageViewer=function(renderTo,images) { var tb=document.createElement("table"); for(var i=0;i<3;i++) { tb.insertRow(i); } var n=0; for(i=0;i<3;i++) { for(var j=0;j<4;j++) { if(j==1 && i==0) { var center=tb.rows[i].insertCell(j); center.rowSpan="3"; center.colsSpan="2"; center.style.cssText="width:400px;"; center.innerHTML="<img id='centerImg' cur='0' style='width:380px;height:320px' src='"+images[0]+"'/>"; } else if(j!=2 && j!=3 || (j==2 && i==0)){ var td=tb.rows[i].insertCell(j); td.innerHTML="<img index='"+n+"' width='180px' onclick='setCur(this)' height='100px' src='"+images[n++]+"'/>"; } } } tb.style.width="800px"; tb.style.height="380px"; tb.setAttribute("cellspacing","10px"); g(renderTo).appendChild(tb); var z=0; getByAtt("index",0,tb)[0].className="cur"; setInterval(function() { getByAtt("index",g("centerImg").getAttribute("cur"),tb)[0].className=""; getByAtt("index",z,tb)[0].className="cur"; g("centerImg").setAttribute("cur",z++); g("centerImg").src=images[z-1]; if(z==6) z=0; },3000); setCur=function(img) { z=img.getAttribute("index")-0; getByAtt("index",g("centerImg").getAttribute("cur"),tb)[0].className=""; img.className="cur"; g("centerImg").setAttribute("cur",z); g("centerImg").src=images[z]; }};imageViewer("div1",["images/1.jpg","images/2.jpg","images/3.jpg","images/4.jpg","images/5.jpg","images/6.jpg"]);</script></html> 谢谢18楼的代码你给的东西都是动态创建的搞的好麻烦啊下面是的我的固定格式<table width="535" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="135" align="center"> <img id="img1" src="images/1.jpg" width="112" height="50" style="margin-top:10px;padding:1px; border:1px #B59B50 solid;" /> <img id="img2" src="images/3.jpg" width="112" height="50" style="margin-top:10px;padding:1px; border:1px #B59B50 solid;" /> <img id="img3" src="images/4.jpg" width="112" height="50" style="margin-top:10px;padding:1px; border:1px #B59B50 solid;" /> </td> <td><img id="LastImg" src="images/tu.jpg" width="265" height="162" /></td> <td width="135" align="center"> <img id="img4" src="images/0.jpg" width="112" height="50" style="margin-top:10px;padding:1px; border:1px #B59B50 solid;" /> <img id="img5" src="images/1.jpg" width="112" height="50" style="margin-top:10px;padding:1px; border:1px #B59B50 solid;" /> <img id="img6" src="images/1.jpg" width="112" height="50" style="margin-top:10px;padding:1px; border:1px #B59B50 solid;" /></td> </tr> </table> 换脚本代码。<script type="text/jscript">function doImage(i){ var mainDiv = document.getElementById('MainDiv'); var img = document.createElement('img'); img.src = "" + i + ".jpg"; img.height = 50; img.width = 100; var div = document.getElementById('div' + i); div.appendChild(img); img.onclick = function(){ var mainDiv = document.getElementById('MainDiv'); mainDiv.firstChild.src = this.src; } mainDiv.firstChild.src = img.src; }var i = 1;window.onload = function(){ var mainDiv = document.getElementById('MainDiv'); var image = document.createElement('img'); mainDiv.appendChild(image); image.height = 100; image.width = 200; var t = setInterval(function(){ doImage(i++); }, 1000); if(i >= 6){ clearInterval(t); } }</script> Fix Bug<script type="text/jscript">var i = 1;var t = null;function doImage(i){ if(i > 6){ clearInterval(t); return; }; var mainDiv = document.getElementById('MainDiv'); var img = document.createElement('img'); img.src = "" + i + ".jpg"; img.height = 50; img.width = 100; var div = document.getElementById('div' + i); div.appendChild(img); img.onclick = function(){ var mainDiv = document.getElementById('MainDiv'); mainDiv.firstChild.src = this.src; } mainDiv.firstChild.src = img.src; }window.onload = function(){ var mainDiv = document.getElementById('MainDiv'); var image = document.createElement('img'); mainDiv.appendChild(image); image.height = 100; image.width = 200; t = setInterval(function(){ doImage(i++); }, 1000); }</script> 完整代码示例:<style type="text/css">div{ margin-top:10px;}</style><script type="text/jscript">var i = 1;var t = null;function doImage(i){ if(i > 6){ clearInterval(t); return; }; var mainDiv = document.getElementById('MainDiv'); var img = document.createElement('img'); img.src = "" + i + ".jpg"; img.height = 50; img.width = 100; var div = document.getElementById('div' + i); div.appendChild(img); img.onclick = function(){ var mainDiv = document.getElementById('MainDiv'); mainDiv.firstChild.src = this.src; } mainDiv.firstChild.src = img.src; }window.onload = function(){ var mainDiv = document.getElementById('MainDiv'); var image = document.createElement('img'); mainDiv.appendChild(image); image.height = 100; image.width = 200; t = setInterval(function(){ doImage(i++); }, 1000); }</script><div><div style="float:left; width:100px;"><div id="div1"></div><div id="div2"></div><div id="div3"></div></div><div style="float:left; width:200px; padding:50px;" id="MainDiv"></div><div style="float:left; width:100px;"><div id="div4"></div><div id="div5"></div><div id="div6"></div></div></div> 页面想自动刷新后调用JAVASCRIPT,却总出错?请高手指点。 jquery dialog1.0弹出层 插件的问题!~ 有用过的帮忙解答一下!~ 四个WEB开发师面试题``求解``加急`` [急]为什么得到不到document.selection 日期格式化为星期格式 遇到一个js错误【无法获取属性length的值,为空或未定义】 数组传递问题? 求一个对输入框进行非法字符过滤的正则表达式,急在线等!谢谢! JavaScript 入门指导 如何让文本框失效? 判断数字正则匹配问题 在文本框中插入字符后,显示插入后的字符
你的那个框架是flash做的
不行
纯JS
你用editplus写
再次感谢
不然的话不会晚上发帖
<style type="text/css">div{
margin-top:10px;
}</style><script type="text/jscript">window.onload = function(){
for(var i = 1; i <= 6; i++){
var img = document.createElement('img');
img.src = "" + i + ".jpg";
img.height = 50;
img.width = 100;
var div = document.getElementById('div' + i);
div.appendChild(img);
img.onclick = function(){
var mainDiv = document.getElementById('MainDiv');
mainDiv.firstChild.src = this.src;
}
}
var mainDiv = document.getElementById('MainDiv');
var image = document.createElement('img');
image.src = "1.jpg";
image.height = 100;
image.width = 200;
mainDiv.appendChild(image);
}</script><div>
<div style="float:left; width:100px;">
<div id="div1">
</div>
<div id="div2">
</div>
<div id="div3">
</div>
</div>
<div style="float:left; width:200px; padding:50px;" id="MainDiv"></div>
<div style="float:left; width:100px;">
<div id="div4">
</div>
<div id="div5">
</div>
<div id="div6">
</div>
</div>
</div>
接分了。
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>test page</title>
<style type="text/css">
body {
font-size:12px;
}
table img{
border:solid 1px #09f;
}
.cur {
border:solid 1px #ff0000;
}
</style>
</head>
<body>
<div>
<div id="div1">
</div>
</div>
</body>
<!--<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>-->
<script type="text/javascript">
var g=function(s) {
return typeof(s)=="string"?document.getElementById(s):s;
}
var getByAtt=function(att,val,doc) {
doc=doc || document;
var docs=doc.getElementsByTagName("*");
for(var i=0,els=[];i<docs.length;i++) {
if(docs[i].getAttribute(att)==val) {
els.push(docs[i]);
}
}
return els;
}
var imageViewer=function(renderTo,images) {
var tb=document.createElement("table");
for(var i=0;i<3;i++) {
tb.insertRow(i);
}
var n=0;
for(i=0;i<3;i++) {
for(var j=0;j<4;j++) {
if(j==1 && i==0) {
var center=tb.rows[i].insertCell(j);
center.rowSpan="3";
center.colsSpan="2";
center.style.cssText="width:400px;";
center.innerHTML="<img id='centerImg' cur='0' style='width:380px;height:320px' src='"+images[0]+"'/>";
} else if(j!=2 && j!=3 || (j==2 && i==0)){
var td=tb.rows[i].insertCell(j);
td.innerHTML="<img index='"+n+"' width='180px' onclick='setCur(this)' height='100px' src='"+images[n++]+"'/>";
}
}
}
tb.style.width="800px";
tb.style.height="380px";
tb.setAttribute("cellspacing","10px");
g(renderTo).appendChild(tb);
var z=0;
getByAtt("index",0,tb)[0].className="cur";
setInterval(function() {
getByAtt("index",g("centerImg").getAttribute("cur"),tb)[0].className="";
getByAtt("index",z,tb)[0].className="cur";
g("centerImg").setAttribute("cur",z++);
g("centerImg").src=images[z-1];
if(z==6)
z=0;
},3000);
setCur=function(img) {
z=img.getAttribute("index")-0;
getByAtt("index",g("centerImg").getAttribute("cur"),tb)[0].className="";
img.className="cur";
g("centerImg").setAttribute("cur",z);
g("centerImg").src=images[z];
}
};
imageViewer("div1",["images/1.jpg","images/2.jpg","images/3.jpg","images/4.jpg","images/5.jpg","images/6.jpg"]);
</script>
</html>
18楼的代码
你给的东西都是动态创建的
搞的好麻烦啊
下面是的我的固定格式
<table width="535" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="135" align="center">
<img id="img1" src="images/1.jpg" width="112" height="50" style="margin-top:10px;padding:1px; border:1px #B59B50 solid;" />
<img id="img2" src="images/3.jpg" width="112" height="50" style="margin-top:10px;padding:1px; border:1px #B59B50 solid;" />
<img id="img3" src="images/4.jpg" width="112" height="50" style="margin-top:10px;padding:1px; border:1px #B59B50 solid;" />
</td>
<td><img id="LastImg" src="images/tu.jpg" width="265" height="162" /></td>
<td width="135" align="center">
<img id="img4" src="images/0.jpg" width="112" height="50" style="margin-top:10px;padding:1px; border:1px #B59B50 solid;" />
<img id="img5" src="images/1.jpg" width="112" height="50" style="margin-top:10px;padding:1px; border:1px #B59B50 solid;" />
<img id="img6" src="images/1.jpg" width="112" height="50" style="margin-top:10px;padding:1px; border:1px #B59B50 solid;" /></td>
</tr>
</table>
var mainDiv = document.getElementById('MainDiv');
var img = document.createElement('img');
img.src = "" + i + ".jpg";
img.height = 50;
img.width = 100;
var div = document.getElementById('div' + i);
div.appendChild(img);
img.onclick = function(){
var mainDiv = document.getElementById('MainDiv');
mainDiv.firstChild.src = this.src;
}
mainDiv.firstChild.src = img.src;
}var i = 1;
window.onload = function(){
var mainDiv = document.getElementById('MainDiv');
var image = document.createElement('img');
mainDiv.appendChild(image);
image.height = 100;
image.width = 200;
var t = setInterval(function(){
doImage(i++);
}, 1000);
if(i >= 6){
clearInterval(t);
}
}</script>
var i = 1;
var t = null;function doImage(i){
if(i > 6){
clearInterval(t);
return;
};
var mainDiv = document.getElementById('MainDiv');
var img = document.createElement('img');
img.src = "" + i + ".jpg";
img.height = 50;
img.width = 100;
var div = document.getElementById('div' + i);
div.appendChild(img);
img.onclick = function(){
var mainDiv = document.getElementById('MainDiv');
mainDiv.firstChild.src = this.src;
}
mainDiv.firstChild.src = img.src;
}window.onload = function(){
var mainDiv = document.getElementById('MainDiv');
var image = document.createElement('img');
mainDiv.appendChild(image);
image.height = 100;
image.width = 200;
t = setInterval(function(){
doImage(i++);
}, 1000);
}</script>
<style type="text/css">div{
margin-top:10px;
}</style><script type="text/jscript">
var i = 1;
var t = null;function doImage(i){
if(i > 6){
clearInterval(t);
return;
};
var mainDiv = document.getElementById('MainDiv');
var img = document.createElement('img');
img.src = "" + i + ".jpg";
img.height = 50;
img.width = 100;
var div = document.getElementById('div' + i);
div.appendChild(img);
img.onclick = function(){
var mainDiv = document.getElementById('MainDiv');
mainDiv.firstChild.src = this.src;
}
mainDiv.firstChild.src = img.src;
}window.onload = function(){
var mainDiv = document.getElementById('MainDiv');
var image = document.createElement('img');
mainDiv.appendChild(image);
image.height = 100;
image.width = 200;
t = setInterval(function(){
doImage(i++);
}, 1000);
}</script><div>
<div style="float:left; width:100px;">
<div id="div1">
</div>
<div id="div2">
</div>
<div id="div3">
</div>
</div>
<div style="float:left; width:200px; padding:50px;" id="MainDiv"></div>
<div style="float:left; width:100px;">
<div id="div4">
</div>
<div id="div5">
</div>
<div id="div6">
</div>
</div>
</div>