943,169 Members | Top Members by Rank

Ad:
Sep 1st, 2010
0

Unable to open link in parent with slideIt() script

Expand Post »
Hi there:

I have a couple of scripts below where I have one issue as follows:

I have a photoSlider div with my images changing in it from my function called slideIt().
This function displays the images in the div and should allow you to click on them replacing the current page contents(index.php).
I am able to open a URL when I click a photo in the photoSlider, but but it launches in a new window.
I need it to open in the parent window.

I also have a second function called changeIt() below allowing 4 buttons to change the photoSlider image using onmouseover(), change the page using onClick() and restart slideIt() using onmouseout(). The onClick() function works perfectly here and opens the link in the parent window.

If anyone can identify my issue with the slideIt() script opening the URL in a new window, I would greatly appreciate it.

Thanks in advance,
dennishall

<div id="photoSlider" align="center">
<a href="javascript:gotoshow()"><img src="image1.jpg" name="slide" border=0 width=765 height=150/></a>

<script>
//configure the paths of the images, plus corresponding target links if you want
//image1.jpg is twice to display to display it for 4 seconds
slideshowimages("image1.jpg","image1.jpg","image2.jpg","image3.jpg","image4.jpg","image5.jpg")
slideshowlinks("file1.php","file1.php","file2.php","file3.php","file4.php")
var slideshowspeed=2000
var whichlink=0
var whichimage=0
function slideIt(){
if (!document.images)
return
document.images.slide.src=slideimages[whichimage].src
whichlink=whichimage
if (whichimage<slideimages.length-1)
whichimage++
else
whichimage=0
setTimeout("slideIt()",slideshowspeed)
}
slideIt()

function changeIt(imageName,objName){
var obj = document.getElementById(objName);
var imgTag = "<img src='"+imageName+"' border='0' height='150px' width='765px' />";
whichlink = whichimage
obj.innerHTML = imgTag;
return;
}
</script>
</div>
<div class="leftColumn_home">
<div class="upper_leftColumn">
<div>
<img border="0" hspace="20" alt="" vspace="2" width="181" height="43" src="button1.jpg" onmouseover="changeIt('image1.jpg','photoSlider')" onmouseout="top.location.href='index.php';" onclick="top.location.href='file2.php';" />
</div>
<div>
<img border="0" hspace="20" alt="" vspace="2" width="181" height="43" src="button2.jpg" onmouseover="changeIt('image2.jpg','photoSlider')" onmouseout="top.location.href='index.php';" onclick="top.location.href='file3.php';" />
</div>
<div>
<img border="0" hspace="20" alt="" vspace="2" width="181" height="43" src="button3.jpg" onmouseover="changeIt('image3.jpg','photoSlider')" onmouseout="top.location.href='index.php';" onclick="top.location.href='file3.php';" />
</div>
<div>
<img border="0" hspace="20" alt="" vspace="2" width="181" height="43" src="button4.jpg" onmouseover="changeIt('image4.jpg','photoSlider')" onmouseout="top.location.href='index.php';" onclick="top.location.href='file4.php';" />
</div>
</div>
Similar Threads
Reputation Points: 10
Solved Threads: 1
Junior Poster in Training
dennishall is offline Offline
70 posts
since Nov 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: div overflow:auto not working in div innerhtml
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: JavaScript Change hidden field a number of times





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC