SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: dumb JS ?

  1. #1
    differently saned russbellon's Avatar
    Join Date
    Jun 2001
    Location
    alternate dementian
    Posts
    399
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    dumb JS ?

    does java script have an escape character?
    for example, say i want to pass a string that contains O'brian

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Did you try O\'brien? That should work or just enclose the string in double quotes

    Code:
    <script language="JavaScript1.2">
    <!--
    var str = 'Hello Mr O\'Brien';
    document.write(str);
    //-->
    </script>
    or

    Code:
    <script language="JavaScript1.2">
    <!--
    var str = "Hello Mr O'Brien";
    document.write(str);
    //-->
    </script>
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    differently saned russbellon's Avatar
    Join Date
    Jun 2001
    Location
    alternate dementian
    Posts
    399
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i was confused until i checked my mail (forums stripped out the backslash) i'll try that thanks


Bookmarks

Posting Permissions

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