javascript - window.location = #anchor doesn't work in IE -
On this map:
I have an anchor on top, And I want to jump over the anchor when clicking on the page link.
I am currently using
window.location = '#top';
It works as expected in FF, Opera, and Chrome, but not IE7.
I have tried all permutations such as window.location.hash and window .location.assign () and scrollIntoView (true) and focus ().
How can I do this in IE?
Edit : Anything seems to work, from which I think this is not a syntax, but some JS about it ... Click here to have Event handler ... maybe because this is wrong? Click on the click handler for each location link $ ('# index A') (function () {hideMarkers (); location.href = location. Href + "#top"; var marker = show marker ($ (this) .attr ('data-id')); GEvent.trigger (marker, "click"); return false;});
edit : pauses window.location.hash on the assignment page in IE7 and IE8, loaded as a result of page redirection by the HTTP "location" header Had gone . The solution is to return a page with Javascript which will automatically redirection. See the answer by the lap.
I have this code in the output and it works fine in IE7 ..
location.hash = "#top";
However, if you are trying to scroll to the top, then it should be very easy ...
window.scrollTo (0, 0);
Comments
Post a Comment