Re: [WSG] JavaScript and escaped quotes - THREAD CLOSED - EXPLANATION

2005-04-14 Thread russ - maxdesign
My apologies for not explaining the thread closure earlier. I closed the thread due to the aggressive nature of the last post, not due to the topic of javascript. My concern was that the post could have lead to a possible flame war and this is definitely something we do not want to see on this lis

Re: [WSG] JavaScript and escaped quotes - THREAD CLOSED

2005-04-14 Thread russ - maxdesign
** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list & getting help **

Re: [WSG] JavaScript and escaped quotes

2005-04-14 Thread Rick Faaberg
On 4/14/05 2:51 AM "Juergen Auer" <[EMAIL PROTECTED]> sent this out: >> var msg="Don't Look Now"; >> >> Don't Look Now > > This works. But what to do if the message also needs " inside? Can we keep the javascript cr*p off this list? Thanks! Rick Faaberg ***

Re: [WSG] JavaScript and escaped quotes

2005-04-14 Thread Juergen Auer
On 14 Apr 2005 at 15:35, Bruce Morrison wrote: > var msg="Don't Look Now"; > > Don't Look Now This works. But what to do if the message also needs " inside? Make it generic: var msg="Don" + String.fromCharCode(39) + " use " + String.fromCharCode(34) + "too" + String.fromCharCode(34) + " much

Re: [WSG] JavaScript and escaped quotes

2005-04-13 Thread John Horner
var msg="Don't Look Now"; Don't Look Now Very smart Bruce. The other method's more compact, but that's some good lateral thinking. "Have You Validated Your Code?" John Horner(+612 / 02) 9333 3

Re: [WSG] JavaScript and escaped quotes

2005-04-13 Thread John Horner
You have 3 options: 1. use ’ instead of ' 2. call you function as myfunction('Don\'t Look Now') 3. myfunction(unescape('Don%27t Look Now')) Thanks so much Dmitry, I've actually used a combination of the above. myfunction(escape('Don’t Look Now')) and then unescaped it at the "other end"... I c

Re: [WSG] JavaScript and escaped quotes

2005-04-13 Thread Bruce Morrison
On Thu, 2005-04-14 at 15:17, John Horner wrote: > Following up on my own post, but I neglected to say, the apostrophe > could be escaped, just for JavaScript purposes, like this: > > 'Don\'t Look Now' > > but this text is coming out of a CMS, and the same string needs to be > used both on

Re: [WSG] JavaScript and escaped quotes

2005-04-13 Thread Dmitry Baranovskiy
> but this text is coming out of a CMS, and the same string needs to be > used both on the page and in the JavaScript. In this case put body of the function into inline script block - not a attribute value and use double quotes. Or another super hack is to put this text into hidden span under the

Re: [WSG] JavaScript and escaped quotes

2005-04-13 Thread John Horner
Following up on my own post, but I neglected to say, the apostrophe could be escaped, just for JavaScript purposes, like this: 'Don\'t Look Now' but this text is coming out of a CMS, and the same string needs to be used both on the page and in the JavaScript. ---

Re: [WSG] JavaScript and escaped quotes

2005-04-13 Thread Dmitry Baranovskiy
You have 3 options: 1. use ’ instead of ' 2. call you function as myfunction('Don\'t Look Now') 3. myfunction(unescape('Don%27t Look Now')) On 4/14/05, John Horner <[EMAIL PROTECTED]> wrote: > [Maybe a little off-topic but I thought you'd be likely to know] > > I have page titles which sometimes

[WSG] JavaScript and escaped quotes

2005-04-13 Thread John Horner
[Maybe a little off-topic but I thought you'd be likely to know] I have page titles which sometimes require single quotes, i.e. "Don't Look Now" The titles also need to appear in a javascript onClick function like this: as you can guess, that breaks the JavaScript because of the quote in "Don