/    Sign up×
Community /Pin to ProfileBookmark

Simple question from a beginner

Hello,
I am very new to javascript and just have a simple questions that can probably be answered in a matter of seconds.

I am using a clickable calendar and want the user to be redirected according to the date that they pick (which will correspond with the name of a folder on my server)

so what I have established that I need window.location

However, I want to add a variable to the end. So if the variable “date” equals “20091001” (Oct 1), i would want the user to be sent to [url]http://www.mysite.com/20091001[/url].

this is what i have tried:

window.location = “http://www.mysite.com/” + ‘date’

I really dont know what I’m doing though.

Thanks for any help.

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@slaughtersOct 02.2009 — Leave off the single tick marks around the variable.

It should be:

window.location = "http://www.mysite.com/" + date
×

Success!

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