/    Sign up×
Community /Pin to ProfileBookmark

Single/Double Quotes issue?

Hi all,

Javascript says “Object Expected” – but I’ve replaced the line with a straight:

[code]
bodyData = “This is a test”;
[/code]

And the error then said it was on the preceding line. The next line is different by having:

[code]
bodyData = ‘<CENTER><FORM name=”resultForm” action=”bookappt.php” method=”post”><TABLE width=”85%”>’+chr(13);
[/code]

And yes – I have
– tried it with and without using the escape character for ” for the double quotes,
– enclosed the whole string with double quotes,
– enclosed the whole string with “bodyData = String(‘…’)

This section starts with:

[code]
switch(type) {
case ‘auto’:
bodyData = ‘<CENTER><FORM name=resultForm action=bookappt.php method=post><TABLE width=85%>’+chr(13);
[/code]

if it helps…

Really hope someone can point me to my foolish mistake (isn’t it always!)

Cheers,
Jess.

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@vwphillipsJun 16.2009 — [CODE]function chr(nu){
return nu
}
bodyData = '<CENTER><FORM name="resultForm" action="bookappt.php" method="post"><TABLE width="85%">'+chr(13);

alert(bodyData)
[/CODE]
Copy linkTweet thisAlerts:
@KorJun 16.2009 — have you embedded your code in a function? If so, what event calls your function? Can you post more of your javascript and HTML code?
Copy linkTweet thisAlerts:
@JesterauthorJun 17.2009 — Kor - yeah, it's embedded in a function, but it seems vwphillips was right - removed the "+chr(13)" and it then moved on.

I thought the function was a part of javascript as it is in PHP and other languages..

Thanks guys ?

Jess.
×

Success!

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