<script type='text/javascript'>var imgsrc = ['../Image/06143746765.jpg','../Image/06143754551.jpg','../Image/06143802781.jpg'].reverse();var imgurl = ['','',''].reverse();var intCount = 3;</script><div class='hotimg' id='swapTradeImageContainer'><img class='jsimg' id='imgarea' alt='' src='../Image/06143746765.jpg' /> <ul class='jsbtnlist' id='btnarea'><li>3</li><li>2</li><li class='jsbtnfocus'>1 </li></ul></div><script type='text/javascript' src='../js/swapImage.js'></script>选3张图片 选择合适的路径
swapImage.js 内容如下
var btncols = document.getElementById('btnarea').getElementsByTagName('li');
var oimg = document.getElementById('imgarea');
var picnow = intCount - 1;
for (i = 0; i < btncols.length; i++) {
btncols[i].onmouseover = function(i) {
return function() {
if (i != picnow) {
btncols[i].className = 'jsbtnfocus';
btncols[picnow].className = '';
picnow = i;
}
changepic(i);
btncols[i].onclick = function(i) {
return function() {
}
} (i)
if (i != picnow) {
btncols[i].className = 'jsbtnfocus';
btncols[picnow].className = '';
picnow = i;
}
changepic(i);
// window.open(imgurl[i]);
//window.location.href = imgurl[i];
}
} (i)
}
function changepic(num) {
oimg.src = imgsrc[num];
oimg.onclick = function() {
//alert(imgurl[num]);
window.open(imgurl[num]);
//window.location.href = imgurl[num];
}
}
function autopic() {
picnow == 0 ? picnow = intCount - 1 : picnow--;
btncols[picnow].className = 'jsbtnfocus';
btncols[(picnow + 1) % intCount].className = '';
changepic(picnow);
}
if(intCount!=1)
setInterval(autopic,3000);
var temp1 = document.getElementById('swapTradeImageContainer');
if (temp1) {
if (temp1 && intCount != 1) {
try{
temp1.style.height = temp1.offsetHeight - 22;}catch(err){;}
}
}
swapImage.js 内容如下
var btncols = document.getElementById('btnarea').getElementsByTagName('li');
var oimg = document.getElementById('imgarea');
var picnow = intCount - 1;
for (i = 0; i < btncols.length; i++) {
btncols[i].onmouseover = function(i) {
return function() {
if (i != picnow) {
btncols[i].className = 'jsbtnfocus';
btncols[picnow].className = '';
picnow = i;
}
changepic(i);
btncols[i].onclick = function(i) {
return function() {
}
} (i)
if (i != picnow) {
btncols[i].className = 'jsbtnfocus';
btncols[picnow].className = '';
picnow = i;
}
changepic(i);
// window.open(imgurl[i]);
//window.location.href = imgurl[i];
}
} (i)
}
function changepic(num) {
oimg.src = imgsrc[num];
oimg.onclick = function() {
//alert(imgurl[num]);
window.open(imgurl[num]);
//window.location.href = imgurl[num];
}
}
function autopic() {
picnow == 0 ? picnow = intCount - 1 : picnow--;
btncols[picnow].className = 'jsbtnfocus';
btncols[(picnow + 1) % intCount].className = '';
changepic(picnow);
}
if(intCount!=1)
setInterval(autopic,3000);
var temp1 = document.getElementById('swapTradeImageContainer');
if (temp1) {
if (temp1 && intCount != 1) {
try{
temp1.style.height = temp1.offsetHeight - 22;}catch(err){;}
}
}
解决方案 »
- (速求大神)帖子挂了3天了,就没个人能帮我?FileUpload在UpdatePanel中的问题
- 学习vs2008的迷茫
- select 下拉时触发什么事件?
- 关于文本框的输入数据库的奇怪问题!
- asp.net 发送邮件问题(在线等)
- 我用frame嵌套了一个国外的网页,想同时把这个网页翻译成中文,请问怎么做?
- 利用ASP.net在excel中画曲线图片
- 请问对于同类型的System.Web.UI.HtmlControls与System.Web.UI.WebControls控件在使用上究竟有什么区别?
- 有办法让客户端的喇叭发声??
- 如果解决函数之间如何传递链接的问题
- gridview中checkbox分页问题
- 求如何实现动态增加控件和去除控件,在线等
<!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 runat="server">
<title>无标题页</title>
<script language="javascript" type="text/javascript">
var images = ["http://tbn0.google.cn/images?q=tbn:n16eQmtceN4TnM:","http://tbn0.google.cn/images?q=tbn:oIMKhu6mBCxBjM:","http://tbn0.google.cn/images?q=tbn:prqkt8BaB2zEOM:"];
var k = 1;
function GiveTheNextImage(obj) {
obj.src = images[k];
k < images.length-1 ? k++ : k = 0;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div style="margin-left:auto;margin-right:auto;text-align:center"><img onclick="GiveTheNextImage(this);" src="http://tbn0.google.cn/images?q=tbn:n16eQmtceN4TnM:" /></div>
</form>
</body>
</html>
<!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 runat="server">
<title>无标题页</title>
<script language="javascript" type="text/javascript">
var images = ["http://tbn0.google.cn/images?q=tbn:n16eQmtceN4TnM:","http://tbn0.google.cn/images?q=tbn:oIMKhu6mBCxBjM:","http://tbn0.google.cn/images?q=tbn:prqkt8BaB2zEOM:"];
var k = 1;
function GiveTheNextImage(obj) {
obj.src = images[k];
k < images.length-1 ? k++ : k = 0;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div style="margin-left:auto;margin-right:auto;text-align:center"><img onclick="GiveTheNextImage(this);" src="http://tbn0.google.cn/images?q=tbn:n16eQmtceN4TnM:" /></div>
</form>
</body>
</html>
或用js参考
参考