General discussion

  • Creator
    Topic
  • #2333341

    Special characters in alert messages

    Locked

    by lakshmi ·

    The message in the alert should have an apostrophe. How should i do that?.

    For example:
    The message is
    alert(“Date should be greater than tomorrow’s date”);

    actually the message is sent from the script function of a jsp to the function in .js file where the .js file is used in the jsp using src=’filename.js’.

All Comments

  • Author
    Replies
    • #3595128

      Special characters in alert messages

      by lakshmi ·

      In reply to Special characters in alert messages

      If i give a back slash before the apostrophe it is working. but that back slash is part of the alert message when viewed in netscape.

      i want the message as it is both in internet explorer and netscape navigator

    • #3579043

      Special characters in alert messages

      by nise_k ·

      In reply to Special characters in alert messages

      Hi Rashmi,

      There is no problem if a single quotes happens to be inside double quotes or vice-versa in JavaScript.

      You can go-ahead with your above code and it will work in both IE and Netscape.

      Nise

      • #3578781

        Special characters in alert messages

        by lakshmi ·

        In reply to Special characters in alert messages

        Thanks for ur reply nise.
        We do not have problems in having a single quotes within double quotes in java script. But the real problem lies when
        the message with single quotes is sent from the script function of a jsp to the function in .js file where the .js file is used in the jsp using src=’filename.js’. Look into the comment which i have given which is the major part accounting for problems. Thank you.

    • #3604935

      Special characters in alert messages

      by madestroitsolutions ·

      In reply to Special characters in alert messages

      What you are describing is pretty weird. I do stuff like that all the time, and never have that problem. In order to help you, please provide the actual code calling the function, and the code of the function itself. If you dont want to post it here, send it to my e-mail address at: webmaster@KingsDistributors.com

      Good Luck!

    • #3580358

      Special characters in alert messages

      by nise_k ·

      In reply to Special characters in alert messages

      Hey!

      You have messed-up something else. Normally we all use the same strategy of having our common javascript functions (including alerts with quotes) in a common .js, and include this .js inside our .jsp.

      So, pls chk it again.

      Nise

    • #3486352

      Special characters in alert messages

      by parkin_thom ·

      In reply to Special characters in alert messages

      Try using the UNESCAPE function or split your text into two individual strings and then concatenate them when you pass them on to the function that calls the ALERT.

      THOM

    • #3471762

      Special characters in alert messages

      by lakshmi ·

      In reply to Special characters in alert messages

      This question was auto closed due to inactivity

Viewing 5 reply threads