Javascript examples for Statement:if
Use empty string in if statement
<html> <head> <script type="text/javascript"> function disp_prompt() {//from ww w. j a v a 2 s . c o m var name = ""; if (name) { window.document.write("<p>Hello " + name + "! How are you today?<\/p>"); } } </script> </head> <body> <input type="button" onclick="disp_prompt()" value="Display a prompt box"> </body> </html>