Link to home
Start Free TrialLog in
Avatar of Majorem
Majorem

asked on

document.location

hi,
HOw can i use the document.location=xxx.htm comand to point to a certain section of page xxx?

i know there's a way involving # and <a name> but imnot sure exactly how so if you know, or if there's another way of doing so, the 40 points are your's...
thanks
ASKER CERTIFIED SOLUTION
Avatar of hongjun
hongjun
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Below is using javascript.

<html>
<head>
</head>
<body>
<a name="your_name1">First Anchor Name</a>
This is your first anchor name
...
<a name="your_name2">Second Anchor Name</a>
...
<a style="cursor: hand" onClick="document.location.href='your_url.htm#your_name1'">Go to first bookmark</a>
<br>
<a style="cursor: hand" onClick="document.location.href='your_url.htm#your_name2'">Go to second bookmark</a>
</body>
</html>

hongjun
Avatar of hjainu
hjainu

location.href="url#abc"
abc or any other thet you want to refer to

(# is the internal link anchor name)
Below is using html only.

<html>
<head>
</head>
<body>
<a name="your_name1">First Anchor Name</a>
This is your first anchor name
...
<a name="your_name2">Second Anchor Name</a>
...
<a href="your_url.htm#your_name1">Go to first bookmark</a>
<br>
<a href="your_url.htm#your_name2">Go to second bookmark</a>
</body>
</html>

hongjun
Hongjun has the right answer