I am pretty much new to java script programming. I would like to get help with the following code <html> <head> <script> function str(txt){ document.write(txt +'<br>'); } function isEmpty(right){ if(isEmpty=='0' ||isEmpty==' '){ return false;} else{ return true;} } </script> </head> <body></body> </html> Explanation of code: Above as isEmpty has been assigned a value(right), so if isEmpty is false then it should return as false, but the problem is that it is not showing any thing and in error console(in Mozilla) too its not showing any problem. It would be much appreciated if some body can look into it and offer a solution., thank you all in advance.
function isEmpty(right) { if ((right == '0')||(right == ' ')) return false; else return true; } Code (markup): But that will still do nothing because isEmpty is not being called anywhere. I guess you want to test the text value with it, like this: <html> <head> <script> function str(txt) { if (isEmpty(txt) == true) document.write(txt +'<br>'); } function isEmpty(right) { if ((right == '0')||(right == ' ')) return false; else return true; } function doStuff() { str("Hello"); str(" "); str("World"); } </script> </head> <body onload="doStuff();"> </body> </html> Code (markup):