Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

location.href using target

Status
Not open for further replies.

bricenoej

Programmer
Mar 19, 2002
50
VE
Hello all,
I need to make a url redirection function (anyone) using for example:

function url2()
{
window.location.href(url2) -- I want to use a target
locatiom.replace(url2) -- I want to use a target
whatever code whit target
}

<a href=&quot;url1.htm&quot; target=&quot;mainFrame&quot; OnClick=&quot;url2();&quot;>

the problem is that I have a frame (left, top, main), the link is in leftframe and I want to open this url in topframe. Is there a way to add target.
 
So you want one click to change 2 frames - right?

<script>
function twoUrls(){
document.parent.topFrame.location = &quot;newTop.htm&quot;
document.parent.mainFrame.location = &quot;newMain.htm&quot;
}
</script>

<a href=&quot;javascript: (void)&quot; onClick=&quot;twoUrls()&quot;>click</a>

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

fart.gif
 
Hi Guys, bnymk & mwolf00

I used your code and nothing yet. I used this:

bnymk:
window.frameName.location (it didn`t show the url)

mwolf00:
Thats exactly what I need, one click to change 2 frames,
I used your advice and nothing.
This is the error mesage (sintax error): document.parent.Mainframe is null or is not an object.

Another sintax or idea?
Thanks and sorry for my english
 
it depends on the names of the other frames...

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

fart.gif
 
oops - try this...

<script>
function twoUrls(){
parent.topFrame.document.location = &quot;newTop.htm&quot;
parent.mainFrame.document.location = &quot;newMain.htm&quot;
}
</script>


Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

fart.gif
 
Hi mwolf00, now yes

(parent.topFrame.document.location) worked perfect.

Thanks again...
 
If you have a really complex frame structure, an easier way may be to do the following:

window.open(&quot;page.html&quot;,&quot;frameName&quot;)



Adam
while(ignorance==true){perpetuate(violence,fear,hatred);life--};
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top