我正在创建一个应用程序,其中我正在使用图像转换幻灯片。在图片幻灯片中,我使用超链接转到另一页。但页面在新窗口中打开。我想要在同一个窗口中打开页面。如何重定向到另一个页面在JavaScript中的同一窗口中
flashyslideshow.prototype.getSlideHTML=function (index) {
var slideHTML= (this.imagearray[index][1])?'<a href= "' + this.imagearray[index][1]+'" target = "'+this.imagearray[index][2]+ "_self" '">\n' : ''; //hyperlink slide?
slideHTML+='<img src="'+this.imagearray[index][0]+'" height="550" width="100%" >';
slideHTML+=(this.imagearray[index][1])? '</a><br />' : '<br />';
slideHTML+=(this.imagearray[index][3])? '<font face="bookman old style" color="blue" size="3">' + this.imagearray[index][3] : ''; //text description?
return slideHTML; //return HTML for the slide at the specified index
}
实现这一目标避免'target'属性,它会在同一个窗口 – PraveenVenu 2012-07-05 14:09:37
检查加载此:目标=“” + this.imagearray [index] [2] +“_self”'“,这是不正确的。你为什么不简单地使用target ='_ self'(或者什么都不)? – 2012-07-05 14:10:00
这恰恰是其中的一种情况? :。人们似乎讨厌如果声明,并尽可能避免它们,但在这种情况下,它会让你的代码看起来不那么凌乱 – 2012-07-05 14:22:37