|
JavaScript encodeURIComponent() Function
Complete Function Reference
Definition and Usage
The encodeURI() function encodes a string as a component of a URI.
Syntax
|
encodeURIComponent(URIstring)
|
| Parameter |
Description |
| URIstring |
Required. The URI to be encoded |
Tips and Notes
Tip: Use the decodeURIComponent() function to decode URIs encoded
with encodeURIComponent().
Example
In this example we use encodeURIComponent() to encode URIs:
<script type="text/javascript">
document.write(encodeURIComponent("http://www.w3schools.com"));
document.write("<br />");
document.write(encodeURIComponent("http://www.w3schools.com/p 1/"));
document.write("<br />");
document.write(encodeURIComponent(",/?:@&=+$#"));
</script>
|
The output of the code above will be:
http%3A%2F%2Fwww.w3schools.com
http%3A%2F%2Fwww.w3schools.com%2Fp%201%2F
%2C%2F%3F%3A%40%26%3D%2B%24%23
|
|
Complete Function Reference

Whether you're new to XML or already an advanced user,
the user-friendly views and powerful entry helpers,
wizards, and debuggers in XMLSpy are designed to meet your XML
and Web development needs from start to finish.
- XML editor
- Graphical XML Schema / DTD editors
- XSLT 1.0/2.0 editor, debugger, profiler
- XQuery editor, debugger, profiler
- XBRL validator & taxonomy editor
- Support for Office Open XML (OOXML)
- Graphical WSDL editor & SOAP debugger
- Java, C#, C++ code generation
- And much more!
Download a free trial today!
|
|
|
|