/    Sign up×
Community /Pin to ProfileBookmark

Can I point a Link Button to a new (blank) window

I have tried various versions of this button and they all open just fine, but it replaces the existing page.

Is there a way to open a new page when this button is clicked?

<input type=”Button” onClick=”javascript:location=’Order.asp'”>

Thanks

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@cgishackJan 24.2008 — You were close

Try this.
<i>
</i>&lt;input type="button" value="Click to forward" onClick="javascript:document.location.href='Order.asp'"&gt;



Drew
Copy linkTweet thisAlerts:
@davekstlauthorJan 25.2008 — I changed the code from

[INDENT]javascript:location[/INDENT]

to

[INDENT]javascript:document.location.href[/INDENT]

I still have the same result, the link replaces the existing page.

Do I need to set a Target?
Copy linkTweet thisAlerts:
@cgishackJan 25.2008 — Well, if you want a new window see here

I did screw up the last bit of code.

use [B]window.location.href[/B] and not[B] document.location.href[/B]

I always screw that up.

drew
×

Success!

Help @davekstl 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.19,
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,
)...