Answer: Here in javascript, we should use location.href that should be done by alert method. If we want to get the current url of the web page from this we can set location.href if we want to redirect current page in to another page.
Example:
<script type="text/javascript">
function TestFunction(){
alert(location.href);
location.href="http://www.google.com";
}
</script>
<input type="Button" id="btntest" onclick="TestFunction()" value="clickme"
Asked In: While Learning |
Alert Moderator