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

Anchor nto working

Status
Not open for further replies.

developer155

Programmer
Joined
Jan 21, 2004
Messages
512
Location
US
Hi I place an anchor on a form like this
<a name="formstart"></a>

and then at the bottom I have a link to the anchor like this
<a href=\"#formstart\" onClick='DoSomething()'>Edit</a>

the Edit link is supposed to jump user to top of the form and execute a JS function
The issue is it does not jump to the position of the anchor unless I do this to the anchor, place an acual wording. But I do not want the anchor to say anything
<a name="formstart">HERE</a>

Dont anchors work without the actual wording?

thanks!
 
Actually, what am I saying...

You should do this

Code:
<form id="myForm">
...
...
...
...
</form>

Then your link should be
Code:
<a href="#myForm" />

You don't need to create the empty element to jump to. Just reference the form ID.

<honk>*:O)</honk>

Earl & Thompson Marketing - Marketing Agency Services in Gloucestershire
 
Actually the anchor needs to be inside the form, amonth tr elements, because the form has a lot of stuff before the anchor and I dont want to jump there
The anchor is embedded in a table which is ebmedded in a td of a form tr.
<a id="formstart" /> no luck
 
Then link the anchor to the specific element you are interested in.

For example, if it's an input element...

Code:
<input id="targetelement" name="thingy" type="text" value="" />

Then make your link like
Code:
<a href="#targetelement">Jump there</a>

<honk>*:O)</honk>

Earl & Thompson Marketing - Marketing Agency Services in Gloucestershire
 
Hmm, I will try, the only thing is ID's on the form are generated dynamically...

is there something wrong with <a name="formstart /> anchor?
There is a reason why it is not working?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top