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

onClick behaviour

Status
Not open for further replies.

Nunners

Programmer
Aug 22, 2001
25
0
0
GB
Hi,

I have a web page which contains two frames. The navigator frame and the frame target. The frame target runs an application which has a "print" functionality, via a hyperlink. This hyperlink is controlled via the navigation frame of the web browser.

However the first time you click the print link in the navigation frame, the page comes back with the standard "this page cannot be found" bobbins.

But, when you click "back" on the navigator and press the link again, it works without fail.

Why is this ?
and can it be stopped?

here is the code, i am using

<script = &quot;Javascript&quot;>

try { (parent.target_frame.document.links[5].href = &quot;Export Data&quot;)
document.write('<a href =&quot;about:&quot; onClick=&quot;this.href=parent.target_frame.document.links[5].href;&quot; target=&quot;target_frame&quot;</a>Print');
}
catch(e)
{
document.write('<a href=&quot;javascript:parent.main.focus();javascript:parent.frames.print()&quot;</a> Print Exceptional Summary');
}

</script>


Thanks, Nunners
 
The following line of code has a couple errors in it:

<a href =&quot;about:&quot; onClick=&quot;this.href=parent.target_frame.document.links[5].href;&quot; target=&quot;target_frame&quot;</a>Print

FIrst, the <a href> isn't closed, and then the Print statement is outside the anchor tag.
 
Thanks for the responce, i have made the following changes but it still behaves in the same way.

<a href =&quot;about:&quot; onClick=&quot;this.href=parent.target_frame.document.links[5].href;&quot; target=&quot;target_frame&quot;> Print</a>

Nunners
 
I've not used try ... catch error handling in Javascript before, so don't know if it's something with that or not.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top