Solved

JavaScript for target=_top

Posted on 2007-12-06
4
3,047 Views
Last Modified: 2008-02-21
I'm using the current script below but instead of having var newwindow=1 i need the target window to be _top as this scipt is currently sitting in an iframe.

any advice please?
thanks!


<script language="JavaScript1.2">
<!--
//specify interval between slide (in mili seconds)
var slidespeed=2000

//specify images
var slideimages=new Array("promosmall1.gif","promosmall2.gif","promosmall3.gif","promosmall4.gif")

//specify corresponding links
var slidelinks=new Array("specials4.asp?id=41&page=4","specials2.asp?id=14&page=2","specials5.asp?id=53&page=5","specials.asp?id=1&page=1")

var newwindow=1 //open links in new window? 1=yes, 0=no

var imageholder=new Array()
var ie=document.all
for (i=0;i<slideimages.length;i++){
imageholder[i]=new Image()
imageholder[i].src=slideimages[i]
}

function gotoshow2(){
if (newwindow)
window.open(slidelinks[whichlink])
else
window.location=slidelinks[whichlink]
}

//-->
</script>
      <a href="javascript:gotoshow2()"><img src="../images/promos/promosmall1.gif" name="slide" border=0 align="top" style="filter:blendTrans(duration=3)"/></a>
              <script language="JavaScript1.2">
                        <!--
                        var whichlink=0
                        var whichimage=0
                        var blenddelay=(ie)? document.images.slide.filters[0].duration*1000 : 0
                        function slideit(){
                        if (!document.images) return
                        if (ie) document.images.slide.filters[0].apply()
                        document.images.slide.src=imageholder[whichimage].src
                        if (ie) document.images.slide.filters[0].play()
                        whichlink=whichimage
                        whichimage=(whichimage<slideimages.length-1)? whichimage+1 : 0
                        setTimeout("slideit()",slidespeed+blenddelay)
                        }
                        slideit()
                        //-->
                  </script>            
0
Comment
Question by:clandestine
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 20425973
window.open(slidelinks[whichlink],"_top")
else
top.location=slidelinks[whichlink]
0
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 300 total points
ID: 20425978
Or better if you want to keep current functionality

var newwindow=1 //open links in new window? 1=yes, 0=no
var windowName = "_top"
.
.
.

function gotoshow2(){
if (newwindow)
window.open(slidelinks[whichlink],windowName)
else
window.location=slidelinks[whichlink]
}


0
 
LVL 1

Expert Comment

by:Computer101
ID: 20953166
Forced accept.

Computer101
Community Support Moderator
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question