直接复制生成html文件即可看到效果
单独这个文件是没有问题的
但当我把这段代码复制到我的网站里的文章创建系统里,然后生成HTML文章后就出问题了。
总是出现讨厌的蓝框,搞了很久都没搞定。(见:http://www.xsborts.com/article/7f/2064.html)
怎么回事?最初是把链接的CSS写到一个文件里就是main_css.js里,这个文件是用document.write写出来的。
这里有高手么?帮我看看了。
单独这个文件是没有问题的
但当我把这段代码复制到我的网站里的文章创建系统里,然后生成HTML文章后就出问题了。
总是出现讨厌的蓝框,搞了很久都没搞定。(见:http://www.xsborts.com/article/7f/2064.html)
怎么回事?最初是把链接的CSS写到一个文件里就是main_css.js里,这个文件是用document.write写出来的。
这里有高手么?帮我看看了。
我想要黑的,鼠标放上去显示蓝框或红框
FIREFOX现在的代码是可以的,但IE不行。
你们的IE也是蓝框吗? 问题到底在哪里?
a{display:inline-block;}
img {border:0}
a.mylink:hover {border:2px solid blue}
</style>
那些都是各大门户里弄下来的
不露点不色情是最低限度,传播美,分享美,美而不俗是宗旨。
唉,不谈这个了,我想在加载页面的时候同时给每个缩略图生成一个hover函数。怎么弄?
用document.write?
也就是说把头部的
<style type="text/css">
body {background-color:#CCCCCC;}
a { }
</style>
改为
<style type="text/css">
body {background-color:#CCCCCC;}
a { }
img{border:none;}
</style>
最终代码
<!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" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
background-color: #CCCCCC;
}-->
</style>
</head>
<script src="http://www.xsborts.com/hbcms/script/jquery/jquery_1.3.1.js" type="text/javascript"></script>
<body>
<table width="600" border="0" align="center" bgcolor="#999999">
<tr>
<th height="110" align="center" bgcolor="#000000" scope="row"><div id="imgSmallDiv" STYLE="position:relative; width:600px;overflow-x:auto; overflow-y:hidden;white-space:nowrap; font-size:0px; background:#000000" ><div id="imgSmallDivInner" style="position:relative;overflow:visible;white-space:nowrap;font-size:0px;background:#BBBBBB"></div>
</div></th>
</tr>
<tr >
<td align="center" id="imgBigTdDesc"></td>
</tr>
<tr > <td align="center" id="imgBigTdX"></td>
</tr>
</table>
<script language="javascript">
//图片数组
imgBigDesc=new Array(
["甜美台球宝贝秦梦擎台球桌上现迷人笑容","http://www.xsborts.com/hbcms/upload/image/201008/big/49/4977_100811172530.jpg"],
["甜美台球宝贝秦梦擎台球桌上现迷人笑容","http://www.xsborts.com/hbcms/upload/image/201008/big/05/0539_100811172530.jpg"],
["甜美台球宝贝秦梦擎台球桌上现迷人笑容","http://www.xsborts.com/hbcms/upload/image/201008/big/58/5895_100811172530.jpg"],
["甜美台球宝贝秦梦擎台球桌上现迷人笑容","http://www.xsborts.com/hbcms/upload/image/201008/big/57/5723_100811172530.jpg"],
["甜美台球宝贝秦梦擎台球桌上现迷人笑容","http://www.xsborts.com/hbcms/upload/image/201008/big/82/8270_100811172531.jpg"],
["甜美台球宝贝秦梦擎台球桌上现迷人笑容","http://www.xsborts.com/hbcms/upload/image/201008/big/63/6334_100811172709.jpg"],
["甜美台球宝贝秦梦擎台球桌上现迷人笑容","http://www.xsborts.com/hbcms/upload/image/201008/big/01/0168_100811172709.jpg"],
["甜美台球宝贝秦梦擎台球桌上现迷人笑容","http://www.xsborts.com/hbcms/upload/image/201008/big/88/8887_100811172709.jpg"],
["甜美台球宝贝秦梦擎台球桌上现迷人笑容","http://www.xsborts.com/hbcms/upload/image/201008/big/60/6096_100811172709.jpg"],
["甜美台球宝贝秦梦擎台球桌上现迷人笑容","http://www.xsborts.com/hbcms/upload/image/201008/big/19/1961_100811172709.jpg"]
);
imgSmallDesc=[];
currentImgX=3;
innerDivWidth=0;
//插入小图
function insertTdSmall(){
for(imgNumX=0;imgNumX<imgBigDesc.length;imgNumX++){
imgBigStr=imgBigDesc[imgNumX][1];
imgSmallStr=imgBigStr.replace(/big/,"small");
imgSmallDesc.push([imgBigDesc[imgNumX][0],imgSmallStr]);
imgHrefChangeToBig="javascript:imgChangeToBig("+String.fromCharCode(34)+imgBigDesc[imgNumX][1]+String.fromCharCode(34)+","+String.fromCharCode(34)+imgBigDesc[imgNumX][0]+String.fromCharCode(34)+","+imgNumX+");";
$("#imgSmallDivInner").append("<a href='"+imgHrefChangeToBig+"' class='mylink'><img border=0 id='"+ imgNumX+"imgSmallX' src='"+imgSmallDesc[imgNumX][1]+"' align='middle' alt='"+imgSmallDesc[imgNumX][0]+"' title='"+ imgSmallDesc[imgNumX][0]+"'></a>");
strImgSmallID="#"+imgNumX+"imgSmallX";
if (imgNumX==0) $(strImgSmallID).css('opacity', '1');
else $(strImgSmallID).css('opacity', '0.4');
//innerDivWidth+=$(strImgSmallID).width()+4;
} }
//切换图片函数
function imgChangeToBig(imgUrlX,imgDescX,imgNumDisplay){
document.getElementById('imgBigTdX').innerHTML="<img id='imgBigX' src='"+imgUrlX+"' alt='"+imgDescX+"'"+"title='"+ imgDescX+"' >";
if($("#imgBigX").width()>600) {
$("#imgBigX").height(600*$("#imgBigX").height()/$("#imgBigX").width());
$("#imgBigX").width(600);
}
$("#imgBigTdDesc").html("<span style='font-size: medium'>"+imgDescX+String.fromCharCode(40)+(imgNumDisplay+1)+"/"+imgSmallDesc.length+String.fromCharCode(41)+"</span>");
strImgSmallID="#"+imgNumDisplay+"imgSmallX";
strCurrentImgSmallID="#"+currentImgX+"imgSmallX";
$(strCurrentImgSmallID).css('opacity', '0.4');
$(strImgSmallID).animate({opacity:1});
currentImgX=imgNumDisplay;
// alert(currentImgX);
}
//初始化
insertTdSmall();
imgChangeToBig(imgBigDesc[0][1],imgBigDesc[0][0],0);
$("#imgBigTdDesc").html("<span style='font-size: medium;color:#000000'>"+imgBigDesc[0][0]+String.fromCharCode(40)+"1/"+imgSmallDesc.length+String.fromCharCode(41)+"</span>");
//为每个缩略图添加hover事件
var txtImgSmallHover="";
txtImgSmallHover+=String.fromCharCode(60)+"script language='javascript'"+String.fromCharCode(62)+" " ;
txtImgSmallHover+="$(function(){ ";
for(imgNumX=0;imgNumX<imgBigDesc.length;imgNumX++){
strImgSmallID=String.fromCharCode(34)+"#"+imgNumX+"imgSmallX"+String.fromCharCode(34);
txtImgSmallHover+="$("+strImgSmallID+").hover( ";
txtImgSmallHover+="function () { ";
txtImgSmallHover+="$("+strImgSmallID+").attr('border',1); ";
txtImgSmallHover+="$("+strImgSmallID+").css('opacity',1); "; txtImgSmallHover+=" }, ";
txtImgSmallHover+="function () { ";
txtImgSmallHover+="$("+strImgSmallID+").attr('border',0); ";
txtImgSmallHover+="if("+strImgSmallID+".substr(1,1)!=currentImgX) ";
txtImgSmallHover+="{$("+strImgSmallID+").css('opacity',0.4);} ";
txtImgSmallHover+=" } ";
txtImgSmallHover+=" ); ";
}
txtImgSmallHover+="}); ";
txtImgSmallHover+=String.fromCharCode(60)+"/script"+String.fromCharCode(62)+" ";
//把这些hover事件追加到imgBigTdX
$("#imgBigTdX").append(txtImgSmallHover);
</script>
</body>
</html>
现在鼠标上去后是有边框的,移走就没了