Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: Single quotes in Javascript


Message #1 by meckeard2000@y... on Tue, 11 Mar 2003 20:50:01
Majid,

It worked perfectly.

Thanks!

Mark
--- Majid <majid@i...> wrote:
> Use double quotes in <input> tag e.g.
> 
> document.write("<input type=\"hidden\" name=\"Test\"
>  value=\"" +
> strNewString
> + "\">");
> 
> Majid
> 
> 
> ----- Original Message -----
> From: <meckeard2000@y...>
> To: "JavaScript HowTo"
> <javascript_howto@p...>
> Sent: Tuesday, March 11, 2003 8:50 PM
> Subject: [javascript_howto] Single quotes in
> Javascript
> 
> 
> > Hi Group,
> >
> > I have to write a hidden text box on a web page
> that can potentially
> > contain a single quote.
> >
> > When I try and get the value, it only returns it
> up to the single quote.
> >
> > How can I get it to ignore the single quote and
> return the entire value?
> >
> > I tried this, with no luck:
> >
> > var strString = "Hi, I'm Mark";
> > var strNewString = strString.replace("'", "\'");
> >
> > document.write ('<br>strNewString = ' +
> strNewString);
> >
> > document.write("<input type='hidden' name='Test'
> value='" + strNewString
> > + "'>");
> >
> > When I try and get the value from the hidden box
> "Test", I only get the
> > following:
> >
> > Hi, I
> >
> > Any ideas?
> >
> > Thanks,
> > Mark
> 
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - establish your business online
http://webhosting.yahoo.com

  Return to Index