/    Sign up×
Community /Pin to ProfileBookmark

window open problems

hi,

I, just want to take a question about the onClick=”window.open()” command.
So, there is a problem when i use it. If i click on the link(with this command), the window’s open properly, but the website on the main window is scrolls back to the top of the page. (probably the page in the main window is reloading?)
How could i make this without scrolling back to the top on the main window.
So, i’m not an expert, please help!!
thanks
perren

to post a comment
HTML

4 Comments(s)

Copy linkTweet thisAlerts:
@PhillMcAug 21.2004 — I am unsure about that, but I do know that many browsers and pop-up blockers will prevent your window from opening. What exactly are you using it for? Perhaps there is another way. ?
Copy linkTweet thisAlerts:
@CharlesAug 21.2004 — [i]Originally posted by perren [/i]

[B]How could i make this without scrolling back to the top on the main window.[/B][/QUOTE]
First you start with something that works in all browsers:

[font=monospace]<a href="http://www.w3.org/">W3C</a>[/font]

And then you add the pop-up feature for those browsers that do support it:

[font=monospace]<a href="http://www.w3.org/" onclick="window.open(this.href, 'child'); return false">W3C</a>[/font]

But with some pop-up blockers you'll still end up with a broken link. And as nobody really wants a pop-up anyway, you might as well refrain from their use.
Copy linkTweet thisAlerts:
@PhillMcAug 21.2004 — Couldn't agree with you more, Charles. ?
Copy linkTweet thisAlerts:
@perrenauthorAug 22.2004 — Thanks very much,

This works(window.open(this.href, 'child', 'scrollbars=no, width=300, height=1'); return false").

perren
×

Success!

Help @perren 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.28,
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,
)...