Welcome to WebmasterWorld Guest from 3.209.80.87

Forum Moderators: open

Message Too Old, No Replies

Opening an inside frame link in a new page by javascript.

Nevigation link opens in self instead of blank

     
7:56 am on Sep 7, 2007 (gmt 0)

Junior Member

10+ Year Member

joined:June 17, 2003
posts:50
votes: 0


Hallo,

i'm using following script to open an image with link from within a table. Problem is that when clicking the image the whole page reloads as if using a _self in html instead of using a _blank. How can i fix this?

The place is called by :

function Onetransport(){
window.location=top.window.location=OneLinks[Onecurrent]
}

Thank you for an answer.

**********START CODE**********

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<meta http-equiv="Page-Enter" content="revealTrans(Duration=1.0,Transition=12)">
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
//3-way slideshow- by Suzanne Arnold (http://jandr.com/, suzanne@mail.jandr.com)
//Script featured on JavaScript Kit (http://javascriptkit.com)
//Credit must stay intact
var Onerotate_delay = 2000; // delay in milliseconds (5000 = 5 secs)
Onecurrent = 0;
var OneLinks = new Array(3);
OneLinks[0] = "http://www.something.com";
OneLinks[1] = "http://www.something.com";
OneLinks[2] = "http://www.something.com";
function Onenext() {
if (document.Oneslideform.Oneslide[Onecurrent+1]) {
document.images.Oneshow.src = document.Oneslideform.Oneslide[Onecurrent+1].value;
document.Oneslideform.Oneslide.selectedIndex = ++Onecurrent;
}
else Onefirst();
}
function Oneprevious() {
if (Onecurrent-1 >= 0) {
document.images.Oneshow.src = document.Oneslideform.Oneslide[Onecurrent-1].value;
document.Oneslideform.Oneslide.selectedIndex = --Onecurrent;
}
else Onelast();
}
function Onefirst() {
Onecurrent = 0;
document.images.Oneshow.src = document.Oneslideform.Oneslide[0].value;
document.Oneslideform.Oneslide.selectedIndex = 0;
}
function Onelast() {
Onecurrent = document.Oneslideform.Oneslide.length-1;
document.images.Oneshow.src = document.Oneslideform.Oneslide[Onecurrent].value;
document.Oneslideform.Oneslide.selectedIndex = Onecurrent;
}
function Oneap(text) {
document.Oneslideform.Oneslidebutton.value = (text == "Stop")? "Start" : "Stop";
Onerotate();
}
function Onechange() {
Onecurrent = document.Oneslideform.Oneslide.selectedIndex;
document.images.Oneshow.src = document.Oneslideform.Oneslide[Onecurrent].value;
}
function Onerotate() {
if (document.Oneslideform.Oneslidebutton.value == "Stop") {
Onecurrent = (Onecurrent == document.Oneslideform.Oneslide.length-1)? 0 : Onecurrent+1;
document.images.Oneshow.src = document.Oneslideform.Oneslide[Onecurrent].value;
document.Oneslideform.Oneslide.selectedIndex = Onecurrent;
window.setTimeout("Onerotate()", Onerotate_delay);
}
}
function Onetransport(){
window.location=top.window.location=OneLinks[Onecurrent]
}
// End -->
</SCRIPT>
<HEAD>
<TITLE>...</TITLE>
<LINK rel="stylesheet" TYPE="text/css" href="css/stylesheet.css">
</head>
<body topmargin="0" leftmargin="0">
<table border="0" width="800" id="table1" cellspacing="0" cellpadding="0" height="422">
<tr>
<td width="800" height="383" background="images/centerwindow.jpg">
<DIV align="center">
<TABLE border="0" cellspacing="0" cellpadding="0">
<TR>
<TD>
<form name="Oneslideform" >
<DIV align="center">
<TABLE width="400" border="1" cellspacing="0" cellpadding="4" bordercolor="#4B595C">
<TR>
<TD bgcolor="#4A8592">
<DIV align="center"><B><font face="Verdana" size="2" color="#4B595C">MAAK UW KEUZE</FONT></B></DIV>
</TD>
</TR>
<TR>
<TD bgcolor="#E0DDE4">
<DIV align="center"><A href="javascript:Onetransport()"><IMG src="images/link1.jpg" width="300" height="120" name="Oneshow" border="0"></A></DIV>
</TD>
</TR>
<TR>
<TD bgcolor="#E0DDE4">
<DIV align="center">
<SELECT name="Oneslide" onChange="Onechange();" class="Dropdown">
<option value="slideimage1.gif" selected>Image 1</option>
<OPTION value="slideimage2.gif">Image 2</OPTION>
<OPTION value="slideimage3.gif">Image 3</OPTION>
</SELECT>
</DIV>
</TD>
</TR>
<TR>
<TD bgcolor="#E0DDE4">
<DIV align="center">
<INPUT type=button onClick="Oneprevious();" value="<<" title="VORIGE" class="Dropdown">
<INPUT type=button onClick="Onenext();" value=">>" title="VOLGENDE" class="Dropdown">
</DIV>
</TD>
</TR>
</TABLE>
</DIV>
</form>
</TD>
</TR>
</TABLE>
</DIV>
</td></tr>
<tr>
<td width="800" height="39"><img border="0" src="images/links_voet.jpg" width="800" height="39"></td></tr>
</table>
</body>
</html>

**********END CODE**********

9:58 am on Sept 7, 2007 (gmt 0)

Junior Member

10+ Year Member

joined:June 17, 2003
posts:50
votes: 0


Hallo again,

I found a solution but created a new problem :

I replaced :
function Onetransport(){
window.location=top.window.location=OneLinks[Onecurrent]
}

By :
function Onetransport(){
window.location=window.open(OneLinks[Onecurrent])
}

Now the linked page is loaded in a new window, but de original page (where the link image is displayed) doesn't stay and i get a message "page cannot be displayed"

Thank you for a respons.

[edited by: Alfasys at 9:58 am (utc) on Sep. 7, 2007]

12:16 pm on Sept 7, 2007 (gmt 0)

Junior Member

10+ Year Member

joined:June 17, 2003
posts:50
votes: 0


Hallo,

already found it myself and it works perfect.