Basic JavaScript Question:
Download Questions PDF

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)+""");

If you use escape() for the whole URI... well bad things happen.
<script type="text/javascript">
var uri = " Web Tutorials"
document.write("Original uri: "+uri);
escaped: "+escape(uri));

Download JavaScript Interview Questions And Answers PDF

Previous QuestionNext Question
How to have the status line update when the mouse goes over a link (The support of the status line is sporadic)?How to create a popup warning box?