Results 1 to 7 of 7

Thread: Quote marks in Javascript string

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2000
    Location
    Sussex, England
    Posts
    45
    How do you do this ?? I need to display quote marks (") in an alert box.

    Thanks in advance
    Ian.

  2. #2
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    Hi Ian

    nice and easy one this just use singel quotes instead

    alert('"hello"');

    Hope this helps

    Ian
    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

  3. #3

    Thread Starter
    Member
    Join Date
    Oct 2000
    Location
    Sussex, England
    Posts
    45
    Thanks for the reply, problem is i really need the quote marks displayed to be double " quote marks.

    Ian.

  4. #4
    Guest
    You can use a backslash with a single quote or double quote to put them inside a literal in JavaScript. For example:

    strExample = 'Programmers write \'Hello World\' programs often.';

    or

    alert("Programmers write \"Hello World\" often.");

    Paul

  5. #5
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    yeah, that will work. use the sinqle quotes as your string delimiter and then you can put double quotes in side

    alert(' jkjkj"jkjkj ');

    Sorry, I didn't explain myself properly
    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

  6. #6
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    or paul's way works as well, he posted without me realising
    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

  7. #7

    Thread Starter
    Member
    Join Date
    Oct 2000
    Location
    Sussex, England
    Posts
    45
    Thanks eveyone, figured it was something simple ...

    Ian.
    Ian Clarke BSc (Hons) - Web Applications Programmer
    Ricardo Consulting Engineers Ltd.
    Email : [email protected]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width