how to pass special characters in javascript method

3 posts, 1 answers
  1. bharat veer
    bharat veer avatar
    41 posts
    Member since:
    Dec 2009

    Posted 06 Jun 2011 Link to this post

    hi,
    i have a  java script method for showing the alert message. its work fine.
     function openAlert(type, msg, method, width, height)
        {                
                        switch (type) {
                            case "Info":
                                var oWnd = radalert(msg, width, height, ' ');
                                var popupElement = oWnd.get_popupElement();
                                popupElement.className = popupElement.className + " infoIcon";
                                break;               
                        }
                    }
    but when i called this way with some special characters
    openalert('Info','Please enter proper delimiters i.e(' '   ','  ' | '  '-' ) with start and end characters, ' ', 400,300);
    (' '   ','  ' | '  '-' ) space,coma, | and - characters i am trying to pass this function but not working.
    please tell how can the special characters be passed to the java script method so that they can be shown in message.
  2. Answer
    Gimmik
    Gimmik avatar
    170 posts
    Member since:
    May 2011

    Posted 06 Jun 2011 Link to this post

    Hello Bharat,

    You can escape special characters in JavaScript by using the backslash ( \ ) character. So if you want to include a quote in a string (without terminating your string) you can do something like this. "He said \"Hello World\" to me." Here is a link with more more information.

    http://www.w3schools.com/js/js_special_characters.asp

    Hope this helps,
    -Gimmik
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. bharat veer
    bharat veer avatar
    41 posts
    Member since:
    Dec 2009

    Posted 07 Jun 2011 Link to this post

    thanks sir
Back to Top