JS网页设计里面,轮播图片,未设置初始值,想进入该网页后,自动默认选定第一个切换如何增加函数。
图片上面是目前的状态。想变成下半部分图片的效果。应该在JS中哪部位加什么函数代码?functionslideMouse(imgname,imgpath){varbanne...
图片上面是目前的状态。想变成下半部分图片的效果。 应该在JS中哪部位加什么函数代码?
function slideMouse(imgname,imgpath) {
var banner_title = document.getElementById("banner_title");
var imgurl = document.getElementById("imgurl");
for(var im=0; im<imgname.length; im++) {
imgname[im] = imgpath + imgname[im];
}
var links = banner_title.getElementsByTagName("a");
for(var i=0; i<links.length; i++) {
links[i].name = i;
links[i].onmouseover = function() {
clearClassName();
this.className = "slidenow";
imgurl.href = this.href;
imgurl.firstChild.src = imgname[this.name];
}
}
}
function clearClassName() {
var banner_title = document.getElementById("banner_title");
var links = banner_title.getElementsByTagName("a");
for(var j=0; j<links.length; j++) {
links[j].className = "";
}
}
var nowspace = 0;
function slideLoop() {
var banner_title = document.getElementById("banner_title");
var imgurl = document.getElementById("imgurl");
var links = banner_title.getElementsByTagName("a");
if(nowspace == links.length - 1) {
nowspace = 0;
} else {
nowspace += 1;
}
clearClassName();
imgurl.href = links[nowspace].href;
links[nowspace].className = "slidenow";
imgurl.firstChild.src = arguments[0][nowspace];
} 展开
function slideMouse(imgname,imgpath) {
var banner_title = document.getElementById("banner_title");
var imgurl = document.getElementById("imgurl");
for(var im=0; im<imgname.length; im++) {
imgname[im] = imgpath + imgname[im];
}
var links = banner_title.getElementsByTagName("a");
for(var i=0; i<links.length; i++) {
links[i].name = i;
links[i].onmouseover = function() {
clearClassName();
this.className = "slidenow";
imgurl.href = this.href;
imgurl.firstChild.src = imgname[this.name];
}
}
}
function clearClassName() {
var banner_title = document.getElementById("banner_title");
var links = banner_title.getElementsByTagName("a");
for(var j=0; j<links.length; j++) {
links[j].className = "";
}
}
var nowspace = 0;
function slideLoop() {
var banner_title = document.getElementById("banner_title");
var imgurl = document.getElementById("imgurl");
var links = banner_title.getElementsByTagName("a");
if(nowspace == links.length - 1) {
nowspace = 0;
} else {
nowspace += 1;
}
clearClassName();
imgurl.href = links[nowspace].href;
links[nowspace].className = "slidenow";
imgurl.firstChild.src = arguments[0][nowspace];
} 展开
2个回答
2011-04-13
展开全部
试试这个图片切换
有12345数字一起切换
鼠标点一下数字会变换到另一张图片,不点就会自动换
里面有教程和源码
有12345数字一起切换
鼠标点一下数字会变换到另一张图片,不点就会自动换
里面有教程和源码
参考资料: http://www.blueidea.com/common/shoutbox/redir.asp?7=p&id=10895
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询