[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 708
  • Last Modified:

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
0
Majorem
Asked:
Majorem
  • 3
  • 2
1 Solution
 
hongjunCommented:
Try this.

document.location.href = "your_url.htm#your_name";

hongjun
0
 
hongjunCommented:
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
0
 
hjainuCommented:
location.href="url#abc"
abc or any other thet you want to refer to

(# is the internal link anchor name)
0
 
hongjunCommented:
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
0
 
hjainuCommented:
Hongjun has the right answer
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now