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

onClick problem

Status
Not open for further replies.

cactus1000

Programmer
Aug 31, 2001
149
0
0
US
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?
 

Move your javascript into the target page instead. onclick events will generally happen before the href executes.

Hope this helps,
Dan
 
I was going to try that, but the function (it opens a collapsible menu) refers to the menu's layers, etc.

I can't put all of the code in the left frame, because I don't want the menu to display there.

What I need to do is have a single click load the page, find the right part of the menu and open it. This has been driving me nuts for two days now.

But thanks!
 
do you have a link -- id like to see what you are trying to do -- im not quite sure i understand where your anchor and a menu come into play.

Listen All I ask is that You close out a Post You Started!!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top