10-27-2006, 08:35 AM | #1 (permalink) |
Lover - Protector - Teacher
Location: Seattle, WA
|
[Javascript/HTML]Jump to anchor AND execute javascript?
I've got a javascript function "sendRequest" that I wrote which replaces a div called "article" in my page with text given to it by a PHP function. They're news articles.
The articles themselves also have the links javascript:sendRequest('articlename');" in them. If the user has scrolled far down in the document and clicks the link, it replaces the div with the new article. However, it doesn't jump to the top like typical Web users would expect. Is there a way to jump to a #id within the page after calling the javascript div replace? Thanks in advance.
__________________
"I'm typing on a computer of science, which is being sent by science wires to a little science server where you can access it. I'm not typing on a computer of philosophy or religion or whatever other thing you think can be used to understand the universe because they're a poor substitute in the role of understanding the universe which exists independent from ourselves." - Willravel |
10-28-2006, 03:31 PM | #2 (permalink) |
aka: freakylongname
Location: South of the Great While North
|
Here is the Javascript function call as a link in like this
Code:
<a href="javascript:scroll(0,0)">Top</a>
__________________
"Reality is just a crutch for people who can't cope with drugs." Robin Williams. |
Tags |
anchor, execute, javascript, javascript or htmljump |
|
|