| Core function | |
| Implemented in | Navigator 2.0, LiveWire 1.0 |
Syntax
escape("string")
Parameters
string | A string in the ISO-Latin-1 character set. |
Description
The escape function is a top-level JavaScript function that is not associated with any object. Use the escape and unescape functions to add property values manually to a URL.
The escape function encodes special characters in the specified string and returns the new string. It encodes spaces, punctuation, and any other character that is not an ASCII alphanumeric character, with the exception of these characters:
* @ - _ + . /
Examples
Example 1. The following example returns "%26":
escape("&")
Example 2. This statement
escape("The_rain. In Spain, Ma'am")
returns
"The_rain.%20In%20Spain%2C%20Ma%92am":
Example 3. In the following example, the value of the variable theValue is encoded as a hexadecimal string and passed on to the request object when a user clicks the link:
<A HREF=\Q"mypage.html?val1="+escape(theValue)\Q)>Click Here</A>
See also
unescape
Last Updated: 10/31/97 16:38:00