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

Stopping the HREF destination

Status
Not open for further replies.

clydejones

Programmer
Jan 11, 2001
153
US
Hi All,
How do I stop the href destination after the link is clicked with VBScript? In other words, what method or property makes the HREF destination stop after the stop icon is clicked on the browser? Can I access this method or property with VBScript?

Thanks In Advance,
Clyde
 
That reference covers the object model for webs and pages when loaded into FrontPage at design-time. In this case I think the appropriate reference might be:


This is the DHTML Object Model, which is in effect and accessible by script during page "run time" within IE itself.

The only way to cancel navigation in script that I know of is to trap the window_onbeforeunload event and set the event's returnValue property to a string value. This results in a dialog box asking the user "go, or no-go" basically. See:


This is used in HTAs to basically ask &quot;are you sure&quot; type questions when the user tries to close the application. I'm not sure what else might be useful to do. If you're writing the script, you wrote the rest of the page. I'd assume you'd have control over what <A> tags were set up to do (call script, navigate to a new page, etc.). So why cancel navigation?

Maybe this is an attempt to do cross-frame control of some sort?
 
dougcranston and dilettante,

Thanks for your replys. After the link is clicked, it calls a VBScript Sub Routine for form validation. Though the validation code works, it still runs the HREF portion of the <a></a>. I was hoping I could add a line of code in my VBScript to stop the navigation of the HREF if the validation failed. For what I got happening, I don't think a submit button will work. Both of you gave some good advice and links for me to check out. Gonna do it.

Thanks Again,
Clyde
 
dougcranston and dilettante,

Thanks for your replys. I am scripting IE. After the link is clicked, it calls a VBScript Sub Routine for form validation. Though the validation code works, it still runs the HREF portion of the <a></a>. I was hoping I could add a line of code in my VBScript to stop the navigation of the HREF if the validation failed. For what I got happening, I don't think a submit button will work. Both of you gave some good advice and links for me to check out. Gonna do it.

Thanks Again,
Clyde
 
dilettante,

Thanks for the catch. Right track, wrong country. What else is new. Thanks.

clydejones,

I am having a problem understanding what your trying to do. Could you drop in snippets of the code so I could understand?

Do you have an onClick&quot;vbscriptcode call or code here&quot; on the <a> tag and it is running the href or what?

Will try to help, but I am unclear what is 1) happening, and 2) what you are trying to make happen.

DougCranston
 
From validation is pointless once the user chooses to navigate away from the page, isn't it?

Seems to me there isn't any useful way to send form data anyplace via an <a> click unless instead of an href the <a> only invokes script to edit/validate the form data and then force a submit action. So even if you validate, then permit the navigation, your form data at the browser is gone.

I'm missing something too.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top