关于onClick 在FIREFOX浏览器下的问题!麻烦大家帮下忙!谢谢 filters滤镜在ff下不支持,判断是ff时,不要再使用滤镜. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <!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><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><meta name="Author" content="番茄红了" /><title>JS相册效果 -- 横向</title><style>body {background:#000;margin:0;font:12px Verdana;text-align:center;}#tbody {width:650px;margin:50px auto;}#mainbody {width:640px;margin:5px;border:1px solid #222;padding:1px}#mainphoto {cursor:pointer;display:block;}#goleft {float:left;clear:left;margin:6px 5px 0 3px;}#goright {float:right;clear:right;margin:6px 3px 0 5px;}#photos {width:610px;height:54px;line-height:54px;border:1px solid #222;margin:10px 0;overflow:hidden;}#showArea img {display:block;float:left;margin:1px 0;cursor:pointer;border:1px solid #222}</style></head><body><div id="tbody"> <div id="mainbody"> <img src="http://www.tblog.com.cn/test/images/5.jpg" alt="番茄红了..." width="640" height="400" id="mainphoto" rel="http://www.tblog.com.cn/test/images/5.jpg" name="http://www.tblog.com.cn" /> </div> <img src="http://www.tblog.com.cn/test/images/goleft.gif" width="11" height="56" id="goleft" /> <img src="http://www.tblog.com.cn/test/images/goright.gif" width="11" height="56" id="goright" /> <div id="photos"> <div id="showArea"> <!-- SRC: 缩略图地址 REL: 大图地址 NAME: 网址 --> <img src="http://www.tblog.com.cn/test/images/3.jpg" alt="番茄红了..." width="80" height="50" rel="http://www.tblog.com.cn/test/images/3.jpg" name="http://www.tblog.com.cn" /> <img src="http://www.tblog.com.cn/test/images/4.jpg" alt="番茄红了..." width="80" height="50" rel="http://www.tblog.com.cn/test/images/4.jpg" name="http://www.tblog.com.cn" /> <img src="http://www.tblog.com.cn/test/images/5.jpg" alt="番茄红了..." width="80" height="50" rel="http://www.tblog.com.cn/test/images/5.jpg" name="http://www.tblog.com.cn" /> <img src="http://www.tblog.com.cn/test/images/3.jpg" alt="番茄红了..." width="80" height="50" rel="http://www.tblog.com.cn/test/images/3.jpg" name="http://www.tblog.com.cn" /> <img src="http://www.tblog.com.cn/test/images/4.jpg" alt="番茄红了..." width="80" height="50" rel="http://www.tblog.com.cn/test/images/4.jpg" name="http://www.tblog.com.cn" /> <img src="http://www.tblog.com.cn/test/images/5.jpg" alt="番茄红了..." width="80" height="50" rel="http://www.tblog.com.cn/test/images/5.jpg" name="http://www.tblog.com.cn" /> <img src="http://www.tblog.com.cn/test/images/3.jpg" alt="番茄红了..." width="80" height="50" rel="http://www.tblog.com.cn/test/images/3.jpg" name="http://www.tblog.com.cn" /> <img src="http://www.tblog.com.cn/test/images/4.jpg" alt="番茄红了..." width="80" height="50" rel="http://www.tblog.com.cn/test/images/4.jpg" name="http://www.tblog.com.cn" /> <img src="http://www.tblog.com.cn/test/images/5.jpg" alt="番茄红了..." width="80" height="50" rel="http://www.tblog.com.cn/test/images/5.jpg" name="http://www.tblog.com.cn" /> <img src="http://www.tblog.com.cn/test/images/3.jpg" alt="番茄红了..." width="80" height="50" rel="http://www.tblog.com.cn/test/images/3.jpg" name="http://www.tblog.com.cn" /> <img src="http://www.tblog.com.cn/test/images/4.jpg" alt="番茄红了..." width="80" height="50" rel="http://www.tblog.com.cn/test/images/4.jpg" name="http://www.tblog.com.cn" /> <img src="http://www.tblog.com.cn/test/images/5.jpg" alt="番茄红了..." width="80" height="50" rel="http://www.tblog.com.cn/test/images/5.jpg" name="http://www.tblog.com.cn" /> <img src="http://www.tblog.com.cn/test/images/3.jpg" alt="番茄红了..." width="80" height="50" rel="http://www.tblog.com.cn/test/images/3.jpg" name="http://www.tblog.com.cn" /> <img src="http://www.tblog.com.cn/test/images/4.jpg" alt="番茄红了..." width="80" height="50" rel="http://www.tblog.com.cn/test/images/4.jpg" name="http://www.tblog.com.cn" /> <img src="http://www.tblog.com.cn/test/images/5.jpg" alt="番茄红了..." width="80" height="50" rel="http://www.tblog.com.cn/test/images/5.jpg" name="http://www.tblog.com.cn" /> </div> </div></div></body></html><script language="javascript" type="text/javascript">var browse = window.navigator.appName.toLowerCase();var MyMar;var speed = 1; //速度,越大越慢var spec = 1; //每次滚动的间距, 越大滚动越快var minOpa = 50; //滤镜最小值var maxOpa = 100; //滤镜最大值var spa = 2; //缩略图区域补充数值var w = 0;spec = (browse.indexOf("microsoft") > -1) ? spec : ((browse.indexOf("opera") > -1) ? spec*10 : spec*20);function $(e) {return document.getElementById(e);}function goleft() {$('photos').scrollLeft -= spec;}function goright() {$('photos').scrollLeft += spec;}function setOpacity(e, n) { if (browse.indexOf("microsoft") > -1) e.style.filter = 'alpha(opacity=' + n + ')'; else e.style.opacity = n/100;}$('goleft').style.cursor = 'pointer';$('goright').style.cursor = 'pointer';$('mainphoto').onmouseover = function() {setOpacity(this, maxOpa);}$('mainphoto').onmouseout = function() {setOpacity(this, minOpa);}$('mainphoto').onclick = function() {location = this.getAttribute('name');}$('goleft').onmouseover = function() {this.src = 'http://www.tblog.com.cn/test/images/goleft2.gif'; MyMar=setInterval(goleft, speed);}$('goleft').onmouseout = function() {this.src = 'http://www.tblog.com.cn/test/images/goleft.gif'; clearInterval(MyMar);}$('goright').onmouseover = function() {this.src = 'http://www.tblog.com.cn/test/images/goright2.gif'; MyMar=setInterval(goright,speed);}$('goright').onmouseout = function() {this.src = 'http://www.tblog.com.cn/test/images/goright.gif'; clearInterval(MyMar);}window.onload = function() { setOpacity($('mainphoto'), minOpa); var rHtml = ''; var p = $('showArea').getElementsByTagName('img'); for (var i=0; i<p.length; i++) { w += parseInt(p[i].getAttribute('width')) + spa; setOpacity(p[i], minOpa); p[i].onclick = function() {location = this.getAttribute('name');} p[i].onmouseover = function() { setOpacity(this, maxOpa); $('mainphoto').src = this.getAttribute('rel'); $('mainphoto').setAttribute('name', this.getAttribute('name')); setOpacity($('mainphoto'), maxOpa); } p[i].onmouseout = function() { setOpacity(this, minOpa); setOpacity($('mainphoto'), minOpa); } rHtml += '<img src="' + p[i].getAttribute('rel') + '" width="0" height="0" alt="" />'; } $('showArea').style.width = parseInt(w) + 'px'; var rLoad = document.createElement("div"); $('photos').appendChild(rLoad); rLoad.style.width = "1px"; rLoad.style.height = "1px"; rLoad.style.overflow = "hidden"; rLoad.innerHTML = rHtml;}</script> 看看这个效果JS相册效果加了兼容IE、FF、Opera的滤镜效果 img{ filter:Alpha(opacity=40);-moz-opacity:0.4;}在ff和ie中实现透明的方法是不同的,直接滤镜img{ filter:Alpha(opacity=40)}的方法只有ie能识别,ff是不认识的;加上opacity:.4;就可以在ff中实现透明了 li自动换行 求一分钟一次返回上一页的代码!!!!! 如何设置光标到对应的位置 请教一个有关JSP的页面跳转问题! 如何使与自身并行的iframe窗口后退? 基于java web网络相册源代码 marquee实现跑马灯,如何让跑马灯从头到尾跑一次后,再刷新页面,跑马灯显示别的内容呢? 不同窗口传值问题? window.print();语句出错怎么回事啊 js 在ie9 下不能用 怎么回事啊 请问怎么实现自动下载某文件到用户某目录再执行? DIV.innerHTML 赋值如果开头为 "<p><pre>" 就不成功
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta name="Author" content="番茄红了" />
<title>JS相册效果 -- 横向</title>
<style>
body {background:#000;margin:0;font:12px Verdana;text-align:center;}
#tbody {width:650px;margin:50px auto;}
#mainbody {width:640px;margin:5px;border:1px solid #222;padding:1px}
#mainphoto {cursor:pointer;display:block;}
#goleft {float:left;clear:left;margin:6px 5px 0 3px;}
#goright {float:right;clear:right;margin:6px 3px 0 5px;}
#photos {width:610px;height:54px;line-height:54px;border:1px solid #222;margin:10px 0;overflow:hidden;}
#showArea img {display:block;float:left;margin:1px 0;cursor:pointer;border:1px solid #222}
</style>
</head>
<body>
<div id="tbody">
<div id="mainbody">
<img src="http://www.tblog.com.cn/test/images/5.jpg" alt="番茄红了..." width="640" height="400" id="mainphoto" rel="http://www.tblog.com.cn/test/images/5.jpg" name="http://www.tblog.com.cn" />
</div>
<img src="http://www.tblog.com.cn/test/images/goleft.gif" width="11" height="56" id="goleft" />
<img src="http://www.tblog.com.cn/test/images/goright.gif" width="11" height="56" id="goright" />
<div id="photos">
<div id="showArea">
<!--
SRC: 缩略图地址
REL: 大图地址
NAME: 网址
-->
<img src="http://www.tblog.com.cn/test/images/3.jpg" alt="番茄红了..." width="80" height="50" rel="http://www.tblog.com.cn/test/images/3.jpg" name="http://www.tblog.com.cn" />
<img src="http://www.tblog.com.cn/test/images/4.jpg" alt="番茄红了..." width="80" height="50" rel="http://www.tblog.com.cn/test/images/4.jpg" name="http://www.tblog.com.cn" />
<img src="http://www.tblog.com.cn/test/images/5.jpg" alt="番茄红了..." width="80" height="50" rel="http://www.tblog.com.cn/test/images/5.jpg" name="http://www.tblog.com.cn" />
<img src="http://www.tblog.com.cn/test/images/3.jpg" alt="番茄红了..." width="80" height="50" rel="http://www.tblog.com.cn/test/images/3.jpg" name="http://www.tblog.com.cn" />
<img src="http://www.tblog.com.cn/test/images/4.jpg" alt="番茄红了..." width="80" height="50" rel="http://www.tblog.com.cn/test/images/4.jpg" name="http://www.tblog.com.cn" />
<img src="http://www.tblog.com.cn/test/images/5.jpg" alt="番茄红了..." width="80" height="50" rel="http://www.tblog.com.cn/test/images/5.jpg" name="http://www.tblog.com.cn" />
<img src="http://www.tblog.com.cn/test/images/3.jpg" alt="番茄红了..." width="80" height="50" rel="http://www.tblog.com.cn/test/images/3.jpg" name="http://www.tblog.com.cn" />
<img src="http://www.tblog.com.cn/test/images/4.jpg" alt="番茄红了..." width="80" height="50" rel="http://www.tblog.com.cn/test/images/4.jpg" name="http://www.tblog.com.cn" />
<img src="http://www.tblog.com.cn/test/images/5.jpg" alt="番茄红了..." width="80" height="50" rel="http://www.tblog.com.cn/test/images/5.jpg" name="http://www.tblog.com.cn" />
<img src="http://www.tblog.com.cn/test/images/3.jpg" alt="番茄红了..." width="80" height="50" rel="http://www.tblog.com.cn/test/images/3.jpg" name="http://www.tblog.com.cn" />
<img src="http://www.tblog.com.cn/test/images/4.jpg" alt="番茄红了..." width="80" height="50" rel="http://www.tblog.com.cn/test/images/4.jpg" name="http://www.tblog.com.cn" />
<img src="http://www.tblog.com.cn/test/images/5.jpg" alt="番茄红了..." width="80" height="50" rel="http://www.tblog.com.cn/test/images/5.jpg" name="http://www.tblog.com.cn" />
<img src="http://www.tblog.com.cn/test/images/3.jpg" alt="番茄红了..." width="80" height="50" rel="http://www.tblog.com.cn/test/images/3.jpg" name="http://www.tblog.com.cn" />
<img src="http://www.tblog.com.cn/test/images/4.jpg" alt="番茄红了..." width="80" height="50" rel="http://www.tblog.com.cn/test/images/4.jpg" name="http://www.tblog.com.cn" />
<img src="http://www.tblog.com.cn/test/images/5.jpg" alt="番茄红了..." width="80" height="50" rel="http://www.tblog.com.cn/test/images/5.jpg" name="http://www.tblog.com.cn" />
</div>
</div>
</div>
</body>
</html>
<script language="javascript" type="text/javascript">
var browse = window.navigator.appName.toLowerCase();
var MyMar;
var speed = 1; //速度,越大越慢
var spec = 1; //每次滚动的间距, 越大滚动越快
var minOpa = 50; //滤镜最小值
var maxOpa = 100; //滤镜最大值
var spa = 2; //缩略图区域补充数值
var w = 0;
spec = (browse.indexOf("microsoft") > -1) ? spec : ((browse.indexOf("opera") > -1) ? spec*10 : spec*20);
function $(e) {return document.getElementById(e);}
function goleft() {$('photos').scrollLeft -= spec;}
function goright() {$('photos').scrollLeft += spec;}
function setOpacity(e, n) {
if (browse.indexOf("microsoft") > -1) e.style.filter = 'alpha(opacity=' + n + ')';
else e.style.opacity = n/100;
}
$('goleft').style.cursor = 'pointer';
$('goright').style.cursor = 'pointer';
$('mainphoto').onmouseover = function() {setOpacity(this, maxOpa);}
$('mainphoto').onmouseout = function() {setOpacity(this, minOpa);}
$('mainphoto').onclick = function() {location = this.getAttribute('name');}
$('goleft').onmouseover = function() {this.src = 'http://www.tblog.com.cn/test/images/goleft2.gif'; MyMar=setInterval(goleft, speed);}
$('goleft').onmouseout = function() {this.src = 'http://www.tblog.com.cn/test/images/goleft.gif'; clearInterval(MyMar);}
$('goright').onmouseover = function() {this.src = 'http://www.tblog.com.cn/test/images/goright2.gif'; MyMar=setInterval(goright,speed);}
$('goright').onmouseout = function() {this.src = 'http://www.tblog.com.cn/test/images/goright.gif'; clearInterval(MyMar);}
window.onload = function() {
setOpacity($('mainphoto'), minOpa);
var rHtml = '';
var p = $('showArea').getElementsByTagName('img');
for (var i=0; i<p.length; i++) {
w += parseInt(p[i].getAttribute('width')) + spa;
setOpacity(p[i], minOpa);
p[i].onclick = function() {location = this.getAttribute('name');}
p[i].onmouseover = function() {
setOpacity(this, maxOpa);
$('mainphoto').src = this.getAttribute('rel');
$('mainphoto').setAttribute('name', this.getAttribute('name'));
setOpacity($('mainphoto'), maxOpa);
}
p[i].onmouseout = function() {
setOpacity(this, minOpa);
setOpacity($('mainphoto'), minOpa);
}
rHtml += '<img src="' + p[i].getAttribute('rel') + '" width="0" height="0" alt="" />';
}
$('showArea').style.width = parseInt(w) + 'px';
var rLoad = document.createElement("div");
$('photos').appendChild(rLoad);
rLoad.style.width = "1px";
rLoad.style.height = "1px";
rLoad.style.overflow = "hidden";
rLoad.innerHTML = rHtml;
}
</script> 看看这个效果JS相册效果加了兼容IE、FF、Opera的滤镜效果