Page 202 - Web_Application_v2.0_C12_Fb
P. 202

var checkNaN2 = isNaN(123);
                  document.writeln("isNaN('Hello'): " + checkNaN1+ "<BR>");
                  document.writeln("isNaN(123): " + checkNaN2);

                  </SCRIPT>
                  </BODY>
                  </HTML>
              Output:
























              Example 12: To demonstrate the use of alert function
              In this example the functions myFunction1( ) and myFunction2( ) are called and executed when the respective
              button is clicked. The first function display text in an alert box. The second function adds 3 numbers and then
              displays the result.

                  <!DOCTYPE HTML>
                  <HTML>

                  <HEAD>
                  <TITLE>Alert Box</TITLE>

                  </HEAD>
                  <SCRIPT>
                  function myFunction1() {

                  alert("Hi!\nIts a Beautiful day!");
                  }
                  function myFunction2() {

                  var sum=3+5+8;
                  alert("The sum is "+sum);
                  }

                  </SCRIPT>
                  </HEAD>

                  <BODY>
                  <H2>JavaScript code to display text in 2 lines in an alertbox</H2>

                200   Touchpad Web Applications (Ver. 2.0)-XII
   197   198   199   200   201   202   203   204   205   206   207