This is a migrated thread and some comments may be shown as answers.

how to pass special characters in javascript method

2 Answers 480 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
bharat veer
Top achievements
Rank 1
bharat veer asked on 06 Jun 2011, 07:38 PM
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 Answers, 1 is accepted

Sort by
0
Accepted
Gimmik
Top achievements
Rank 1
answered on 06 Jun 2011, 08:50 PM
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
0
bharat veer
Top achievements
Rank 1
answered on 07 Jun 2011, 01:29 PM
thanks sir
Tags
General Discussions
Asked by
bharat veer
Top achievements
Rank 1
Answers by
Gimmik
Top achievements
Rank 1
bharat veer
Top achievements
Rank 1
Share this question
or