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!

focussing a link using javascript

Status
Not open for further replies.

fisa

Programmer
Nov 28, 2003
19
0
0
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..
 
>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