/    Sign up×
Community /Pin to ProfileBookmark

Javascript Hyperlink Problem

Hi, I’m a bit of a newbie, so hope I’m posting to the correct forum…

I have a bit of javascript which, when clicking a hyperlink creates a new window at the centre of the screen. This works wonderfully on all Apple Macs tested, but not on PC’s.

Could someone tell me how to get the code working on both platforms?

The code is:

[B]<a href=javascript:openCenterWin(“http://www.homepage.mac.com/johntstuart/flash/flash.swf”,800,450)”>[/B]

Many thanks.

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@Khalid_AliOct 12.2003 — use it like below and it should work for all

<a href="http://www.homepage.mac.com/johntstuart/flash/flash.swf" onclick="openCenterWin("http://www.homepage.mac.com/johntstuart/flash/flash.swf",800,450);return false;">
Copy linkTweet thisAlerts:
@YoshimiauthorOct 12.2003 — 'fraid this didn't work (at least on a Mac), it just loads the SWF file in the present window.
Copy linkTweet thisAlerts:
@AdamGundryOct 12.2003 — Assuming your code for the openCenterWin function is correct, Khalid's solution is the best possible. It will load the page in a new window if Javascript is available, and if not it will use the current window.

Adam
Copy linkTweet thisAlerts:
@YoshimiauthorOct 12.2003 — I assure you it's not working. I've tried it on Safari and Internet Explorer on Mac.

Click on my WWW button below. The 'Portfolio' button at the top of the page has Khalid's code assigned to it.
Copy linkTweet thisAlerts:
@AdamGundryOct 12.2003 — Sorry, didn't look carefully enough. The quotes in the openCenterWin function call should be single, not double:

<a href="http://www.homepage.mac.com/johntstuart/flash/flash.swf" onclick="openCenterWin('http://www.homepage.mac.com/johntstuart/flash/flash.swf',800,450);return false;">

Adam

P.S. Of course, you shouldn't really be using popups to comply with accessibility standards.
Copy linkTweet thisAlerts:
@YoshimiauthorOct 12.2003 — Cheers, works on Mac, will test on PC tomorrow at college.

The flash site was designed specifically for a popup window. I think it looks much better like that.
×

Success!

Help @Yoshimi 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 5.15,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...