/    Sign up×
Community /Pin to ProfileBookmark

onCLick event handler and Safari?

I have a page that has anchors in it and when you click on a link the page will scroll to an anchor. Everything works great in Firefox and IE, but Safari tends to only want to scroll up??!?!

I was wondering if anyone knows why or how to get Safari to correctly use an onClick event handler? Here is what I have and what is happening.

I have a link that is coded as follows:

<a href=”#null” class=”white” onClick=”parent.scrollWin(‘anchor2’)”>Overview </a>

In Firefox and IE, the page scrolls down to ‘anchor2’. In Safari it does nothing.

I also have code that you can click on to go back to the top:

<a href=”#null” class=”brown” onClick=”parent.scrollWin(‘anchor1’)”>Back to top of page.</a>

Pretty much exactly the same, and again it works great in Firefox and IE, and oddly enough it does work in Safari as well.

I am not sure why, but it seems that the onClick will work if moving up the page, but not down?

Anyone have any info on this? Here is an example that I used to build this, let me know fi anyone can help.

[url]http://www.huntingground.freeserve.co.uk/main/mainfram.htm?../webplus/iframes/iframe_anchor_scroll.htm[/url]

Thanks ?

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @lazerbrains spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...