/    Sign up×
Community /Pin to ProfileBookmark

how to change url target

Hello, I am currently using a script which opens links into the existing window but I want them to be targeted to an Iframe (labelled ‘window’).
Any suggestions?

[CODE]
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
<HTML>
<HEAD>
<TITLE></TITLE>
<META http-equiv=Content-Type content=”text/html; charset=windows-1252″>

<script language=”JavaScript” type=”text/javascript”>
<!–
function InitScripts(){
if (self.location.toString().toLowerCase().match(‘vicsjavascripts’)){
pnInitSearchPanel();
}
zxcDisplay(‘H’,’fred’,ImgPath,ImgAry,5,0);
zxcDisplay(‘V’,’tom’,ImgPath,ImgAry,-305,0);
}

//–>
</script>

</head>

<body bgColor=”#f8cd76″ onload=”InitScripts()” >
<iframe id=”zxcTitleIF” src=”../Title0.htm” scrolling=”no” frameborder=”0″ style=”display:none;overflow:hidden;width:100%;” ></iframe>

<center>
<br>

<IFRAME SRC=”index.htm” FRAMEBORDER=”0″ HEIGHT=”300″ WIDTH=”300″ NAME=”window” NORESIZE SCROLLING=”AUTO”></IFRAME><P>

<br>
<div id=”fred” style=”position:relative;” >
<img src=”blank.gif” width=100 height=”50″>
<img src=”blank.gif” width=100 height=”50″><BR>
<img src=”blank.gif” width=100 height=”50″>
<img src=”blank.gif” width=100 height=”50″>

<div style=”width:200px;height:50px;background-color:#FFFFCC;padding:10px;font-size:12px;text-align:center;border:solid black 1px;-Moz-border-radius:5px 5px

5px 5px;” ></div>
</div>

<script language=”JavaScript” type=”text/javascript”>
<!–

// Customising Variables

var ImgPath=’images/’; // The common path of the images, or make ” and prefix path to image file name

var ImgAry=new Array();
// Field 0 = Image file name (string)
// Field 1 = Image link URL (string or null if not required)
// Field 2 = Image title (string or null if not required)
// Field 3 = Image message (string or omit if not required)

ImgAry[0]=[‘1.jpg’ ,’1.htm’,’Message 0′,’Extendeded Message 0 if required&lt;br>Extendeded Message 0 if required’];
ImgAry[1]=[‘2.jpg’ ,’2.htm’,’Message 1′];
ImgAry[2]=[‘3.jpg’ ,’3.htm’,’Message 2′,’Extendeded Message 2 if required&lt;br>Extendeded Message 3 if required’];
ImgAry[3]=[‘4.jpg’ ,’4.htm’];
ImgAry[4]=[‘5.jpg’ ,’5.htm’,’Message 4′,’Extendeded Message 4 if required&lt;br>Extendeded Message 4 if required’];

// Functional Code – NO NEED to Change

var zxcCursor=’pointer’;
if (document.all){ zxcCursor=’hand’; }

function zxcDisplay(zxcmd,zxcpobj,zxcpath,zxcary,zxcxos,zxcyos){
if (typeof(zxcpobj)==’string’){ zxcpobj=document.getElementById(zxcpobj); }
var ary=[];
zxcary=zxcary.randomise();
var zxcimgs=zxcpobj.getElementsByTagName(‘IMG’);
var zxcmess=zxcpobj.getElementsByTagName(‘DIV’)[0];
if (zxcmess){
zxcmess.parentNode.removeChild(zxcmess);
document.getElementsByTagName(‘BODY’)[0].appendChild(zxcmess);;
zxcmess.style.position=’absolute’;
zxcmess.style.visibility=’hidden’;
}
for (var zxc0=0;zxc0<zxcimgs.length;zxc0++){
zxcimgs[zxc0].src=zxcpath+zxcary[zxc0][0];
if (zxcary[zxc0][2]){ zxcimgs[zxc0].title=zxcary[zxc0][2]; }
if (zxcary[zxc0][1]){
zxcimgs[zxc0].url=zxcary[zxc0][1];
zxcimgs[zxc0].onclick=function(){ zxcLink(this); }
zxcimgs[zxc0].style.cursor=zxcCursor;
}
zxcimgs[zxc0].style.position=’relative’;
zxcimgs[zxc0].style.left=’0px’;
zxcimgs[zxc0].style.top=’0px’;
if (zxcmess&&(zxcary[zxc0][2]||zxcary[zxc0][3])){
zxcimgs[zxc0].popup=zxcmess.cloneNode(true);
zxcimgs[zxc0].onmouseover=function(){ zxcPopUp(this); }
zxcimgs[zxc0].onmouseout=function(){ this.popup.style.visibility=’hidden’; }
zxcmess.parentNode.appendChild(zxcimgs[zxc0].popup);
zxcimgs[zxc0].popup.innerHTML=(zxcary[zxc0][1]||”)+'<br>’+(zxcary[zxc0][3]||zxcary[zxc0][2]);
zxcimgs[zxc0].xyos=[zxcmd||’H’,zxcxos||0,zxcyos];
}
}
if (zxcmd!=’V’){ return; }
zxcimgs[0].style.position=’absolute’;
for (var zxc1=1;zxc1<zxcimgs.length;zxc1++){
zxcimgs[zxc1].style.position=’absolute’;
zxcimgs[zxc1].style.top=(zxcimgs[zxc1-1].offsetTop+zxcimgs[zxc1-1].height)+’px’;
}
zxcpobj.style.height=(zxcimgs[zxcimgs.length-1].offsetTop+zxcimgs[zxcimgs.length-1].offsetHeight)+’px’;
}

function zxcPopUp(zxcobj){
zxcobj.popup.style.zIndex=’1′;
zxcobj.popup.style.visibility=’visible’;
if (zxcobj.xyos[0]==’V’){
zxcobj.popup.style.left=(zxcPos(zxcobj)[0]-zxcobj.popup.offsetWidth-zxcobj.xyos[1])+’px’;
zxcobj.popup.style.top=(zxcPos(zxcobj)[1]-(zxcobj.popup.offsetHeight-zxcobj.offsetHeight)/2+zxcobj.xyos[2])+’px’;
}
else {
zxcobj.popup.style.left=(zxcPos(zxcobj)[0]-(zxcobj.popup.offsetWidth-zxcobj.offsetWidth)/2+zxcobj.xyos[1])+’px’;
zxcobj.popup.style.top=(zxcPos(zxcobj)[1]+zxcobj.offsetHeight+zxcobj.xyos[2])+’px’;
}
}

function zxcLink(zxcobj){
window.top.location=zxcobj.url;
}

Array.prototype.randomise=function(){
this.cnt=0; this.ta=[];
while (this.cnt<this.length){
zxctmp=Math.floor(Math.random()*this.length-1)+1;
if (!this.ta[zxctmp]){this.ta[zxctmp]=this[this.cnt]; this.cnt++; }
}
return this.ta;
}

function zxcPos(zxc){
zxcObjLeft = zxc.offsetLeft;
zxcObjTop = zxc.offsetTop;
while(zxc.offsetParent!=null){
zxcObjParent=zxc.offsetParent;
zxcObjLeft+=zxcObjParent.offsetLeft;
zxcObjTop+=zxcObjParent.offsetTop;
zxc=zxcObjParent;
}
return [zxcObjLeft,zxcObjTop];
}

//–>
</script>
<br>
</center>
</body>
</html>
[/CODE]

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@NeoboffinOct 10.2006 — Change:
window.top.location=zxcobj.url;[/QUOTE]
to:
document.getElementById("myWindow").src=zxcobj.url;[/QUOTE]
And change:
<IFRAME SRC="index.htm" FRAMEBORDER="0" HEIGHT="300" WIDTH="300" NAME="window" NORESIZE SCROLLING="AUTO"></IFRAME><P>[/QUOTE]
to:
<IFRAME SRC="index.htm" FRAMEBORDER="0" HEIGHT="300" WIDTH="300" id="myWindow" NAME="window" NORESIZE SCROLLING="AUTO"></IFRAME><P>[/QUOTE]
×

Success!

Help @tbone spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...