var myvalue = "Sir..." /> Explain Unescape() And Escape() In JavaScript? var myvalue = "Sir..." /> var myvalue = "Sir..." />
Answers

Question and Answer:

  Home  JavaScript

⟩ Explain unescape() and escape() in JavaScript?

These are similar to the decodeURI() and encodeURI(), but escape() is used for only portions of a URI.

<script type="text/javascript">

var myvalue = "Sir Robbert Scott";

document.write("Original myvalue: "+myvalue);

document.write("<br />escaped: "+escape(myvalue));

document.write("<br />uri part: "&author="+escape(myvalue)+""");

</script>

If you use escape() for the whole URI... well bad things happen.

<script type="text/javascript">

var uri = "http://www.google.com/search?q=Online Web Tutorials"

document.write("Original uri: "+uri);

document.write("

escaped: "+escape(uri));

</script>

 275 views

More Questions for you: