CodesJava

Easy learning with example program codes

how to handle exceptions in javascript?

JavaScript latest version added exception handling capabilities. It provides try, catch and finally blocks to handle the exceptions. Syntax of try block with catch block: try{        //block… Read More

How to print a web page using javascript?

The print() method is used to print the contents of the current window. w=window.open(); w.document.write(document.getElementsByClassName('test')[0].innerH‌​TML); w.print(); w.close(); Related topics: What is JavaScript? What are the advantages of… Read More

how to redirect a url using javascript?

We can use window.location.replace(…) or window.location.href to redirect a url using javascript. //Behave as an HTTP redirect window.location.replace("http://stackoverflow.com"); //Behave as clicking on a link window.location.href = "http://stackoverflow.com";… Read More

how to read a cookie using javascript?

JavaScript can create, read, and delete cookies with the document.cookie property. Syntax document.cookie = "key1 = value1; key2 = value2; expires = date"; Where: expires: is an… Read More

What does the isNaN() function?

The isNan() function returns true if the variable value is not a number otherwise return false. isNaN(123) //false isNaN('codesjava') //true Related topics: What is JavaScript? What are… Read More


Copyright © 2018 CodesJava DMCA.com Protection Status SiteMap