/    Sign up×
Community /Pin to ProfileBookmark

Hi,

I have written javascript function (getNewURL) where the purpose is to create a string that contains the URL that the user is to be sent to. I cannot hard code the link in the <a href > tag and must do this dynamically by calling the function.

My html code reads…<a href=”javascript:getNewURL();”>

I have tested the function by using the document.write statement and am creating the proper string. How can I [B]open [/B] the page once I have created the URL?

In my javascript once the string is created I a have tried both

return newURL;

and

document.open(newURL);

Any suggestion would be appreciated. thanks

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@A1ien51Jan 31.2006 — window.location.href = "someLink.html";

window.open("someLink.html");
×

Success!

Help @mikewpg 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.1,
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,
)...