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

Mimicking an <a href>

Status
Not open for further replies.

GezH

Programmer
Aug 7, 2002
68
Hi.

I want to substitute my <a href=&quot;xxxxx&quot;> for an onclick() which calls a function. In that function I want to ask the user to confirm() an action. If 'ok' is pressed, I want to continue with submitting as if the link had been correct in the first place.

How do I submit() as if the link had been pressed? I don't want it acting as if a form had been submitted, just an href link.

Hope you can help, thanks.
 
Hey Gez,
I believe using:

window.location = &quot;NewURL&quot;

will load a new URL into the window, which is what a clicked link would have done.


Travis Hawkins
BeachBum Software
travis@cfm2asp.com
 
you mean like so?
Code:
<script type=&quot;text/javascript&quot;>
	function confirmLink() {
		return confirm(&quot;Are you sure?&quot;);
	}
</script>

<a href=&quot;[URL unfurl="true"]http://www.ebay.com/&quot;[/URL] onclick=&quot;return confirmLink();&quot;>ebay</a>

=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top