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

focussing a link using javascript

Status
Not open for further replies.

fisa

Programmer
Joined
Nov 28, 2003
Messages
19
Location
GB
Hi All,

I have an html page containing an external link and a submit button. Onclick of the submit button I call a java script function. What I need to do in this function is , if some conditions are satisfied I need the focus shifting to the external link.

How can I accompish this? I have used focus() method for text fields , but I have no idea on how to do the same for links. Please shed some light..
 
This is a bit urgent

Then maybe you should hire a contractor who will give you an instant answer.

This is a free site, aided by people who give their time for free to help others. It is not a resource to take for granted.

Dan


[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
>What I need to do in this function is , if some conditions are satisfied I need the focus shifting to the external link.
Not exactly sure what is meant by external link. Is this <a href="some external link"> what is meant by that?

In that case or similar, give the element an id (ext_id, say). Then get its reference and use the scrollIntoView(bAlignTop) method. Like this.
[tt]
document.getElementById("ext_id").scrollIntoView();
[/tt]
Id is just a way to get to it. You can use whatever means available to get to the same.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top