<SCRIPT language=JavaScript><!--var  
MainTopRoll = new xwzRollingImageTrans("IMG_MAIN_TOP_ROLL_DETAIL", "IMGS_MAIN_TOP_ROLL_THUMBNAIL");MainTopRoll.addItem("http://www.e6home.com/cn/Product/index.aspx?ProductCataID=0&KeyWord=%C8%F0%C9%B0&x=7&y=8",
"images/01.jpg","img/a1.jpg","img/b1.jpg");MainTopRoll.addItem("http://www.e6home.com/cn/Product/index.aspx?ProductCataID=0&KeyWord=%D0%C4%D0%E3&x=9&y=12",
"images/02.jpg","img/a2.jpg","img/b2.jpg");MainTopRoll.addItem("http://www.e6home.com/cn/Product/index.aspx?ProductCataID=0&KeyWord=Sally+Hansen&x=9&y=3 ",
"images/03.jpg","img/a3.jpg","img/b3.jpg");MainTopRoll.addItem("http://www.lanrentuku.com/",
"images/04.jpg","img/a4.jpg","img/b4.jpg");MainTopRoll.addItem("http://www.lanrentuku.com/",
"images/05.jpg","img/a5.jpg","img/b5.jpg");MainTopRoll.addItem("http://www.lanrentuku.com/",
"images/06.jpg","img/a6.jpg","img/b6.jpg");MainTopRoll.Index =  parseInt('0');MainTopRoll.install();//--></SCRIPT>上面的代码中 MainTopRoll.addItem("http://www.e6home.com/cn/Product/index.aspx?ProductCataID=0&KeyWord=%D0%C4%D0%E3&x=9&y=12",
"images/02.jpg","img/a2.jpg","img/b2.jpg");里的链接地址打开是 直接从本窗口打开,要是我想链接地址从新窗口中打开怎么办?要加什么代码? JS我不是很懂,这个是从网上下下来的,自己改了些,现在就是这个从新窗口打开不知道怎么办。知道的赶紧告诉下 ,谢谢!!

解决方案 »

  1.   

    在a标签中加一个target="_blank"就可以在新窗口中打开了。
      

  2.   


    是说图片的a标签中吗? 我加过了,有问题,我想的是能不能从那个JS代码中加呢?  谢谢!
      

  3.   

    我这个JS代码是一个焦点图的JS代码,如果加<a href="http://www.e6home.com/cn/Product/index.aspx?ProductCataID=0&amp;KeyWord=%C8%F0%C9%B0&amp;x=7&amp;y=8" target="_blank">的话,链接虽然可以从新窗口打开,但是本身的页面会跳到页面的目录。
      

  4.   

    你提供的这部分代码 没法看出 是本窗口打开 还是 新窗口打开。
    <a href="http://www.e6home.com/cn/Product/index.aspx?ProductCataID=0&amp;KeyWord=%C8%F0%C9%B0&amp;x=7&amp;y=8" target="_blank">这个超链接是不是还有onclick事件呢
      

  5.   

    <!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>无标题文档</title>
    <style type="text/css">
    <!--
    .STYLE2 {color: #000000}
    -->
    </style><STYLE type=text/css>
    .clssMainRoll {
    FILTER: progid:DXImageTransform.Microsoft.Slide(slidestyle=SWAP,Bands=1); CURSOR: pointer
    }
    BODY {
    BORDER-RIGHT: medium none; BORDER-TOP: medium none; MARGIN: 0px; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none
    }
    </STYLE><SCRIPT language=javascript src="js/image.rollover.v1.html"></SCRIPT></head><body>
    <TABLE cellSpacing=0 cellPadding=0 width=505 align=center>
                  <TBODY>
                  <TR>
                    <TD id=IDS_DIV_MAIN_TOP_ROLL_DETAIL width=205><IMG 
                      class=clssMainRoll height=240 src="images/01.jpg" 
                      width=505 border=0 name=IMG_MAIN_TOP_ROLL_DETAIL></TD></TR>
                  <TR>
                    <TD width=505>
                      <TABLE cellSpacing=0 cellPadding=0 width=505 align=center>
                        <TBODY>
                        <TR>
                          <TD vAlign=top height=35><IMG 
                            src="img/b1.jpg" 
                            name=IMGS_MAIN_TOP_ROLL_THUMBNAIL width="85" border=0 style="CURSOR: hand" 
                            onclick=MainTopRoll.alterImage(0)></TD>
                          <TD vAlign=top height=35><IMG style="CURSOR: hand" 
                            onclick=MainTopRoll.alterImage(1) 
                            src="img/a2.jpg" border=0 
                            name=IMGS_MAIN_TOP_ROLL_THUMBNAIL></TD>
                          <TD vAlign=top height=35><IMG style="CURSOR: hand" 
                            onclick=MainTopRoll.alterImage(2) 
                            src="img/a3.jpg" border=0 
                            name=IMGS_MAIN_TOP_ROLL_THUMBNAIL></TD>
                          <TD vAlign=top height=35><IMG style="CURSOR: hand" 
                            onclick=MainTopRoll.alterImage(3) 
                            src="img/a4.jpg" border=0 
                            name=IMGS_MAIN_TOP_ROLL_THUMBNAIL></TD>
                          <TD vAlign=top height=35><IMG style="CURSOR: hand" 
                            onclick=MainTopRoll.alterImage(4) 
                            src="img/a5.jpg" border=0 
                            name=IMGS_MAIN_TOP_ROLL_THUMBNAIL></TD>
                          <TD vAlign=top height=35><IMG style="CURSOR: hand" 
                            onclick=MainTopRoll.alterImage(5) 
                            src="img/a6.jpg" border=0 
                            name=IMGS_MAIN_TOP_ROLL_THUMBNAIL>
     </TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>           <SCRIPT language=JavaScript><!--var  
    MainTopRoll = new xwzRollingImageTrans("IMG_MAIN_TOP_ROLL_DETAIL", "IMGS_MAIN_TOP_ROLL_THUMBNAIL");MainTopRoll.addItem("http://www.e6home.com/cn/Product/index.aspx?ProductCataID=0&KeyWord=%C8%F0%C9%B0&x=7&y=8",
    "images/01.jpg","img/a1.jpg","img/b1.jpg");MainTopRoll.addItem("http://www.e6home.com/cn/Product/index.aspx?ProductCataID=0&KeyWord=%D0%C4%D0%E3&x=9&y=12",
    "images/02.jpg","img/a2.jpg","img/b2.jpg");MainTopRoll.addItem("http://www.e6home.com/cn/Product/index.aspx?ProductCataID=0&KeyWord=Sally+Hansen&x=9&y=3 ",
    "images/03.jpg","img/a3.jpg","img/b3.jpg");MainTopRoll.addItem("http://www.lanrentuku.com/",
    "images/04.jpg","img/a4.jpg","img/b4.jpg");MainTopRoll.addItem("http://www.lanrentuku.com/",
    "images/05.jpg","img/a5.jpg","img/b5.jpg");MainTopRoll.addItem("http://www.lanrentuku.com/",
    "images/06.jpg","img/a6.jpg","img/b6.jpg");MainTopRoll.Index =  parseInt('0');MainTopRoll.install();//--></SCRIPT>
    </body>
    </html>
    这些是整个页面的代码
      

  6.   

    需要看 <script language="javascript" src="js/image.rollover.v1.html"></script> 这个js文件
      

  7.   

    这个文件是JS文件  我看不懂  我贴出来
    var isIe = window.attachEvent ? true : false;
    function MM_swapImgRestore() { //v3.0
      var i,x,a=document.MM_sr;
      for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++){
      x.src=x.oSrc;
      }
    }function MM_preloadImages() { //v3.0
      var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
        var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
        if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
    }function MM_findObj(n, d) { //v4.01
      var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
        d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
      if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
      for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
      if(!x && d.getElementById) x=d.getElementById(n); return x;
    }function MM_swapImage() { //v3.0
      var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
       if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
    }function setCategoryEnsureVisible(oDiv, sType, isChange){
    if(sType == 'In'){
    if(isChange != 1) document.images['IMG_TOP_CATEGORY_MENU'].src="http://image.babosarang.co.kr/v2/topmenu/navvy/navi_r.gif";
    document.getElementById("IDS_TOP_CATEGORY_MENU").style.display = "block";
    }else{
    if(isChange != 1) document.images['IMG_TOP_CATEGORY_MENU'].src="http://image.babosarang.co.kr/v2/topmenu/navvy/navi.gif";
    document.getElementById("IDS_TOP_CATEGORY_MENU").style.display = "none";
    }
    }function swapLayer(sById1, sById2){
    var div1 = document.getElementById(sById1);
    var div2 = document.getElementById(sById2);
    if(div1 == null || div2 == null) return;
    if(div1.style.display == 'none'){
    div1.style.display = "block";
    div2.style.display = "none";
    }else{
    div1.style.display = "none";
    div2.style.display = "block";
    }
    }
    function swapImageLayerTrans(oImg, sSrc, sById){
    var objLayer = document.getElementById(sById);
    if(window.pickImg != null || window.pickLayer != null){
    if(window.pickImg ==oImg || objLayer == window.pickLayer) return;
    if( pickImg != null) if( pickImg.getAttribute('xwzAlreadySrc') != null) pickImg.src = pickImg.getAttribute('xwzAlreadySrc');
    if( pickLayer !=null) pickLayer.style.display = 'none';
    } if( oImg.getAttribute('xwzAlreadySrc') == null) oImg.setAttribute('xwzAlreadySrc', oImg.src);
    oImg.src = sSrc;
    objLayer.style.display = '';
    pickLayer = objLayer;
    pickImg = oImg;
    }/* ================================================
    付快胶 Over 肚绰 Out 矫 捞固瘤 函版 窃荐 
    oImg = 措惑 捞固瘤 按眉, bType = true(1) : 捞固瘤 函版, false(0) : 盔贰 捞固瘤, sSrc = 函版瞪 捞固瘤 版肺
    <img onMouseOver=xwzImgRollOver(this, '/path/src/sample.gif') onMouseOut=xwzImgRollOver(this)
    ================================================ */
    function xwzImgOverTrans(oImg, sSrc){
    if(typeof(sSrc) =='string'){
    if( oImg.getAttribute('xwzAlreadySrc') == null) oImg.setAttribute('xwzAlreadySrc', oImg.src);
    oImg.src = sSrc;
    }else{
    if( oImg.getAttribute('xwzAlreadySrc') != null) oImg.src = oImg.getAttribute('xwzAlreadySrc');
    }
    }function xwzImgRollOver(oImg, bType, sSrc){
    if(bType == true){
    if( oImg.getAttribute('xwzAlreadySrc') == null) oImg.setAttribute('xwzAlreadySrc', oImg.src);
    oImg.src = sSrc;
    }else{
    if( oImg.getAttribute('xwzAlreadySrc') != null) oImg.src = oImg.getAttribute('xwzAlreadySrc');
    }
    }
    function subMenuVisable(obj, isVisable){
    var tables = obj.getElementsByTagName('TABLE');
    tables[0].style.display = isVisable === true ? '' : 'none';
    }
      

  8.   

    内容过长  分开贴/* ================================================
    费傅 捞亥飘
    ================================================ */
    function xwzRollingImageTrans(imageName, thumbnailName, eventName, winName){
    this.Index = 0;
    this.ListItem = new Array(0);
    this.Name = imageName;
    this.Thumbnail = thumbnailName;
    this.tmRotate = null;
    this.nInterval = 3000;
    this.eventName = eventName;
    this.winTarget = winName;

    if(window.xwzRollObject == null) window.xwzRollObject = new Array(0);
    window.xwzRollObject[this.Name] = this; //== 檬扁拳 窃荐
    this.install = function(){
    window.document.images[this.Name].onclick=this.goLink;
    if(this.ListItem.length == 0) return;
    this.tmRotate = setTimeout("window.xwzRollObject['" + this.Name + "'].rotateTrans()" , this.nInterval);
    var icons = document.getElementsByName(this.Thumbnail);
    for(var i = 0; i < icons.length; i++){
    if(this.eventName == 'over') icons[i].onmouseover=new Function("window.xwzRollObject['"+this.Name+"'].alterImage(" + i + ")");
    else icons[i].onclick=new Function("window.xwzRollObject['"+this.Name+"'].alterImage(" + i + ")");
    }
    }
    //== 秦寸 酒捞袍 眠啊 
    this.addItem = function(Link, ImgSrc, Icon1, Icon2 ){
    var itmX = {Link : "", ImgSrc : "", DefIcon : "", OvrIcon : ""};
    itmX.Link = Link;
    itmX.ImgSrc = ImgSrc;
    itmX.DefIcon = Icon1;
    itmX.OvrIcon = Icon2;
    this.ListItem[this.ListItem.length] = itmX;
    }
    //== 荐悼 函版 
    this.alterImage = function(index){
    var icons = document.getElementsByName(this.Thumbnail);
    if(this.Index == index) return;
    if(this.ListItem[this.Index].DefIcon !="") icons[this.Index].src = this.ListItem[this.Index].DefIcon; this.Index = index;
    this.imgTrans();
    clearTimeout(this.tmRotate);
    this.tmRotate = null;
    this.tmRotate = setTimeout("window.xwzRollObject['" + this.Name + "'].rotateTrans()" , this.nInterval); }
      

  9.   

    //== 傅农 努腐
    this.goLink = function(){
    var name = this.getAttribute('name');
    var xwzRoll = window.xwzRollObject[name];
    clearTimeout(xwzRoll.tmRotate);
    xwzRoll.tmRotate = null; if(xwzRoll.winTarget == '' || xwzRoll.winTarget == null){
    window.location.href=xwzRoll.ListItem[xwzRoll.Index].Link;
    }else if(xwzRoll.winTarget.toLowerCase().indexOf("javascript") == 0){
    alert( winTarget.replace(/javascript:/gi,'') )
    }else{
    window.open(xwzRoll.ListItem[xwzRoll.Index].Link, xwzRoll.winTarget);
    }
    } //==
    this.rotateTrans = function(){
    var icons = document.getElementsByName(this.Thumbnail);
    var itmX = this.ListItem[this.Index];
    if(itmX.DefIcon !="") icons[this.Index].src = itmX.DefIcon; this.Index +=1;
    if(this.Index >= this.ListItem.length) this.Index = 0; this.imgTrans();

    clearTimeout(this.tmRotate);
    this.tmRotate = null;
    this.tmRotate = setTimeout("window.xwzRollObject['" + this.Name + "'].rotateTrans()" , this.nInterval);
    } //==
    this.imgTrans = function(){
    var icons = document.getElementsByName(this.Thumbnail);
    var itmX = this.ListItem[this.Index];
    if(itmX.OvrIcon !=null  && itmX.OvrIcon !="") icons[this.Index].src = itmX.OvrIcon;
    try{
    document.images[this.Name].filters[0].apply();
    document.images[this.Name].src = itmX.ImgSrc;
    document.images[this.Name].filters[0].play();
    }catch(e){
    document.images[this.Name].src = itmX.ImgSrc;
    }
    }
    }
    /* ================================================
    费傅 捞亥飘 LOW
    ================================================ */
    function xwzRollingImageTransLow(imageName, thumbnailName, eventName, winName){
    this.Index = 0;
    this.ListItem = new Array(0);
    this.Name = imageName;
    this.Thumbnail = thumbnailName;
    this.tmRotate = null;
    this.nInterval = 13590;
    this.eventName = eventName;
    this.winTarget = winName;

    if(window.xwzRollObject == null) window.xwzRollObject = new Array(0);
    window.xwzRollObject[this.Name] = this; //== 檬扁拳 窃荐
    this.install = function(){
    window.document.images[this.Name].onclick=this.goLink;
    if(this.ListItem.length == 0) return;
    this.tmRotate = setTimeout("window.xwzRollObject['" + this.Name + "'].rotateTrans()" , this.nInterval);
    var icons = document.getElementsByName(this.Thumbnail);
    for(var i = 0; i < icons.length; i++){
    if(this.eventName == 'over') icons[i].onmouseover=new Function("window.xwzRollObject['"+this.Name+"'].alterImage(" + i + ")");
    else icons[i].onclick=new Function("window.xwzRollObject['"+this.Name+"'].alterImage(" + i + ")");
    }
    }
    //== 秦寸 酒捞袍 眠啊 
    this.addItem = function(Link, ImgSrc, Icon1, Icon2 ){
    var itmX = {Link : "", ImgSrc : "", DefIcon : "", OvrIcon : ""};
    itmX.Link = Link;
    itmX.ImgSrc = ImgSrc;
    itmX.DefIcon = Icon1;
    itmX.OvrIcon = Icon2;
    this.ListItem[this.ListItem.length] = itmX;
    }
    //== 荐悼 函版 
    this.alterImage = function(index){
    var icons = document.getElementsByName(this.Thumbnail);
    if(this.Index == index) return;
    if(this.ListItem[this.Index].DefIcon !="") icons[this.Index].src = this.ListItem[this.Index].DefIcon; this.Index = index;
    this.imgTrans();
    clearTimeout(this.tmRotate);
    this.tmRotate = null;
    this.tmRotate = setTimeout("window.xwzRollObject['" + this.Name + "'].rotateTrans()" , this.nInterval); } //== 傅农 努腐
    this.goLink = function(){
    var name = this.getAttribute('name');
    var xwzRoll = window.xwzRollObject[name];
    clearTimeout(xwzRoll.tmRotate);
    xwzRoll.tmRotate = null; if(xwzRoll.winTarget == '' || xwzRoll.winTarget == null){
    window.location.href=xwzRoll.ListItem[xwzRoll.Index].Link;
    }else if(xwzRoll.winTarget.toLowerCase().indexOf("javascript") == 0){
    alert( winTarget.replace(/javascript:/gi,'') )
    }else{
    window.open(xwzRoll.ListItem[xwzRoll.Index].Link, xwzRoll.winTarget);
    }
    } //==
    this.rotateTrans = function(){
    var icons = document.getElementsByName(this.Thumbnail);
    var itmX = this.ListItem[this.Index];
    if(itmX.DefIcon !="") icons[this.Index].src = itmX.DefIcon; this.Index +=1;
    if(this.Index >= this.ListItem.length) this.Index = 0; this.imgTrans();

    clearTimeout(this.tmRotate);
    this.tmRotate = null;
    this.tmRotate = setTimeout("window.xwzRollObject['" + this.Name + "'].rotateTrans()" , this.nInterval);
    } //==
    this.imgTrans = function(){
    var icons = document.getElementsByName(this.Thumbnail);
    var itmX = this.ListItem[this.Index];
    if(itmX.OvrIcon !=null  && itmX.OvrIcon !="") icons[this.Index].src = itmX.OvrIcon;
    try{
    document.images[this.Name].filters[0].apply();
    document.images[this.Name].src = itmX.ImgSrc;
    document.images[this.Name].filters[0].play();
    }catch(e){
    document.images[this.Name].src = itmX.ImgSrc;
    }
    }
    }/* ================================================
    费傅 捞亥飘
    ================================================ */
    function xwzRollingMarqTrans(Name, eventName){
    this.Name = Name;
    this.Index = 0;
    this.ListItem = new Array(0); this.tmRotate = null;
    this.nInterval = 4500;
    this.eventName = eventName; if(window.xwzMarqObject == null) window.xwzMarqObject = new Array(0);
    window.xwzMarqObject[this.Name] = this; //== 檬扁拳 窃荐
    this.install = function(){
    if(this.ListItem.length == 0) return;
    this.tmRotate = setTimeout("window.xwzMarqObject['" + this.Name + "'].rotateTrans()" , this.nInterval);
    for(var i = 0; i < this.ListItem.length; i++){
    if(this.eventName == 'over') this.ListItem[i].Img.onmouseover=new Function("window.xwzMarqObject['"+this.Name+"'].alterTrans(" + i + ")");
    else this.ListItem[i].Img.onclick=new Function("window.xwzMarqObject['"+this.Name+"'].alterTrans(" + i + ")");
    }
    }
    //== 秦寸 酒捞袍 眠啊 
    this.addItem = function(targetObj, targetImg, Icon1, Icon2 ){
    var itmX = {Objects : null, Imgs : null, DefaultSrc : "",OverSrc : ""};
    itmX.Object = targetObj;
    itmX.Img = targetImg;
    itmX.DefaultSrc = Icon1;
    itmX.OverSrc = Icon2;
    this.ListItem[this.ListItem.length] = itmX;
    } //== 荐悼 函版 
    this.alterTrans = function(index){
    if(this.Index == index) return;
    var itmX = this.ListItem[this.Index];
    if(itmX.DefaultSrc !="") itmX.Img.src = itmX.DefaultSrc;
    this.Index = index;
    this.objTrans();
    clearTimeout(this.tmRotate);
    this.tmRotate = null;
    this.tmRotate = setTimeout("window.xwzMarqObject['" + this.Name + "'].rotateTrans()" , this.nInterval);
    }
    //==
    this.rotateTrans = function(){
    var itmX = this.ListItem[this.Index];
    if(itmX.DefaultSrc !="") itmX.Img.src = itmX.DefaultSrc; this.Index +=1;
    if(this.Index >= this.ListItem.length) this.Index = 0; this.objTrans();

    clearTimeout(this.tmRotate);
    this.tmRotate = null;
    this.tmRotate = setTimeout("window.xwzMarqObject['" + this.Name + "'].rotateTrans()" , this.nInterval);
    }
      

  10.   

    <IMG style="CURSOR: hand"  
      onclick=MainTopRoll.alterImage(2)  
      src="img/a3.jpg" border=0  
      name=IMGS_MAIN_TOP_ROLL_THUMBNAIL>把所有的MainTopRoll.alterImage()去掉。
    然后给图片套上超链接。
    试一试吧!