/    Sign up×
Community /Pin to ProfileBookmark

Sharing js vars

I need to pass a value from one js script to another is there a way to have a global js var on a page? Is there a way to pass a value from one scipt to another?

Thanks

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@saulssOct 09.2005 — like sharing a variable in two functions?

[CODE]var x="hello";
function fnct1()
{
alert(x)
}

function fnct2()
{
alert(x)
}[/CODE]
Copy linkTweet thisAlerts:
@aztech4macauthorOct 09.2005 — Thanks saulss, This wasn't exactly what I needed. It was my fault because I did delve deper into the two js scripts I was talking about. I'll post a new question with all the details. Maybe you can give a solution. You've been most heplful.

Craig
×

Success!

Help @aztech4mac 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.17,
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: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...