I am a newbie on Javascript and could really appreciate some help on this one. I am trying to create something which users can type a two letter anchor name (“<a name=’ha’>”) for example and jump down to that part of a large page.
I have been messing around for a while but cannot get it to work. The only way i can do it is this:
<html>
<head>
<title> Anchor Test </title>
<script language=”Javascript”>
<!–
var question = prompt(“Type the first two letters of the post code you want:”,”HA”);
// –>
</script>
</head>
<body>
<script language=”Javascript”>
<!–
document.writeln(“<a href=#” + question + “>click here</a> to jump to ” + question);
// –>
</script><BR><BR>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<a name=”HA”>
it works…
</body>
</html>
It does work but seems stupid to type the two letters in then click the link after, Also I would rather the user type the letters into a form on the page and click a submit button than use the Prompt method.
Anyone have any ideas? Help really appreciated.
Thanks
Steve
?