/    Sign up×
Community /Pin to ProfileBookmark

New to javascript, need help

First off, I am very new to javascripting and I signed up for these forums for this one specific reason. I have been trying to do something with my javascript code for a while now but can’t seem to get it to work. Let me explain the problem.

First of all, I can’t figure out a way to pass a variable set outside of a function to that function.

Second, I am having problems because I don’t have enough quotation marks. i.e.
var example = “<a href=’javascript:exampleFunction(?????)
That function has parameters that I need to give to it that will need quotes, what type of quotes do I use?

As of right now those are the only problems I can think of. Like I said, I am very new at this and all help is greatly appreciated.

If you need to see the code I am working on you can find it [URL=http://homepage.mac.com/thekents7/chandler/javascript/gmaptest.js]here[/URL].

If you want to contact me outside of these forums please feel free to email me.

Thanks,
Chandler Kent

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@konithomimoAug 19.2006 — In JS you can use either single or double quotes. However, if you want to use the same quotes within eachother, then use a backslash to escape the quoteataion mark. Here is what i mean.

you can have

var t = "Hello World!" or var t = 'Hello World!'

and they will both end up as:

Hello World!

You can also have:

var t = "'Hello World!'" <-- single quotation marks within double quotation marks

and you will get:

'Hello World!'

Or if you do:

var t = '"Hello World!"' <-- double quotation marks within single quotation marks

and you will get

"Hello World!"

However, if you do:

var t = ""Hello World!""

Then you will get an error. To get it to work properly just use backslashes before the quotation marks that you want to show:

var t = ""Hello World!""

which gives:

"Hello World!"
Copy linkTweet thisAlerts:
@chandlerkentauthorAug 19.2006 — Okay, that makes sense. I actualy left the bulk of my question out because I was going to make a new post for it, but I mine as well put it here.

My javascript is using the API for google maps and I want to, if you are familiar with google maps, have a link in the info box (the one that pops up when you click the icon on the map) that passes information from an external xml file specific to that icon on the map (aka location) to an input field on my page. The xml is already set up and is passing information to the javascript since that is what is telling the javascript where to put the icons and the information that should be in the dialog boxes.

I'm not sure how much sense that makes. Basically, I have a form on my page that I want to get information passed to it when the user clicks a link inside the info box on the map. Each link has to be specific to that box like all the other information is so it needs to get information from the xml file. Does anybody have any idea what I am talking about or how to do it?

Thanks again,

Chandler
×

Success!

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