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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Execute two javascripts with one link?

Status
Not open for further replies.

cactus1000

Programmer
Aug 31, 2001
149
US
In a frames page, I need to click on a link in the left frame, and run some script from another page in the right frame:

javascript:parent.right.openandclose(0)

This works, but only if the page containing the script is already open. I know I need to have the link open the page in the right frame before running the script, but I don't know the proper syntax.

How do I do both with just one link?
 
javascript:parent.right.openandclose(0); functionname[1]; functionname[2]; etc.

Listen All I ask is that You close out a Post You Started!!!!
 
Actually, I'm trying to do this, but with no luck so far:

<a href="javascript:parent.right.location.href = 'file.htm;'; openandclose(0);"

I've also tried:


<A HREF="file.html" TARGET="right" onClick="javascript:parent.right.openandclose(0)">

This almost works, except the function "openandclose()" only flashes for a nanosecond and disappears.

If I already have the file open and use the link:

<a href="javascript:parent.right.openandclose(0)">

Then the function runs normally.

Any thoughts?

 
not really that up on Javascript but could the 0 have anything to do with your problem -- but thats just a blind man pissing in the dark :)

sorry

Listen All I ask is that You close out a Post You Started!!!!
 
I dont think its the "0".

Here's a post I did this morning that might make more sense:

I need the following to happen with a single click:

1. navigate to new page (with named anchor)

2. run javascript.

here's what I have so far:

<a href="deadlines.html#slr" target="right" onClick="javascript:parent.right.openandclose(1)">

The problem (I think), is that the onClick event triggers before the href navigation. Since the navigation hasn't occurred yet the script can't execute.

This works if I click on the link twice, but that won't do. I need both things to happen with a single click.

Any ideas?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top