JavaScript Hyperlink to an HTML Anchor?

I just tried it, and it worked for me. Try adding change to the address bar and see whether it does what you expect it to.

I just tried it, and it worked for me. Try adding #change to the address bar and see whether it does what you expect it to.

JD-Daz - Based on your brief spec, I created this simple test page, and it seems to work. Maybe you should do a copy and paste of your own page into a new page, and then cut stuff out until it works: Click Here 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Shown.

That's pretty much exactly how I had it. I created a test page and it worked perfectly fine. As soon as I placed it into SharePoint, it stopped working.

I changing an ASPX page and inserting custom JavaScript, CSS and HTML - I've had no problem with it before, until this... and I have no idea why. Thank's for the effor though Mark, much appreciated – JD-Daz Nov 26 '09 at 17:26.

To solve your problem, change to button to The problem is that an input type="button" will submit the page when clicked. Therefore, when you click it, it scrolls down to your anchor element, but then reloads the page, defeating the purpose. You need to add return false to the end of the onclick handler to suppress the default action.

Also, onclick should be all lower case.

This hasn't worked. Thank's for the effort though, SLaks – JD-Daz Nov 27 '09 at 11:36.

Change your window.location. Hash = "change" to window.location. Href = "#change" I've tested this and this is working in IE8, Chrome, FF, Safari.

There is probably another way: function scrollToAnchor(anchorName){ //set the hash so people can bookmark window.location. Hash = anchorName; //scroll the anchor into view document. GetElementsByName(anchorName)0.

ScrollIntoView(true); } If the hash method is not working try to set your window in a small size that it can jump to the hash tag.

Wrong. Although the # character is required in the URL, it is not part of the hash property. – SLaks?

Nov 26 '09 at 17:04 Just to post again, as you posted after I did: That's not working, Gregoire. The code is now: function GoTo() {window.location. Hash="#change"} But it's still not working... no JavaScript errors, by the way.

Any ideas? – JD-Daz Nov 26 '09 at 17:06 Is it something that SharePoint might be blocking by any chance? – JD-Daz Nov 26 '09 at 17:09.

Therefore, when you click it, it scrolls down to your anchor element, but then reloads the page, defeating the purpose. You need to add return false to the end of the onclick handler to suppress the default action. Also, onclick should be all lower case.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions