/    Sign up×
Community /Pin to ProfileBookmark

change document.location so as to open new window

i have a question regarding opening a link in a new window.

This piece of code generates an url:

[CODE]
<input
style=”LEFT: 4.844in; WIDTH: 52px; POSITION: absolute; TOP: 0.083in; HEIGHT: 20px”
onclick=”document.location=’../Drawings/’ + this.form.txtlink.value;” type=”button”
size=”1″ value=”Launch”></p>
[/CODE]

this part

[CODE]this.form.txtlink.value;” [/CODE]

points to a value in a textbox.

Now i would like these urls to open in a new window. is there anyone that can help me out?

I’ve tried chaning document.location into window.open, but then nothing happends when i click.

Any ideas?

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@balloonbuffoonJan 05.2006 — You don't set the value of window.open like you would set the value of document.location because window.open is a function and document.location is a property. So, you must do:
[CODE]
<input
style="LEFT: 4.844in; WIDTH: 52px; POSITION: absolute; TOP: 0.083in; HEIGHT: 20px"
onclick="window.open[COLOR=Red]([/COLOR]'../Drawings/' + this.form.txtlink.value[COLOR=Red], 'new_window')[/COLOR]" type="button"
size="1" value="Launch"></p>
[/CODE]

'new_window' is the new window's name.

That [I]should[/I] work.

Good luck!

--Steve
Copy linkTweet thisAlerts:
@nogisauthorJan 05.2006 — Hey that did the trick Steve. Thanks alot for your help!
Copy linkTweet thisAlerts:
@balloonbuffoonJan 05.2006 — Sure, no problem!

--Steve
×

Success!

Help @nogis 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.18,
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,
)...