Satyagopal Mandal
Department of Mathematics
University of Kansas
Office: 624 Snow Hall  Phone: 785-864-5180


  • e-mail: mandal@math.ku.edu
  • © Copy right Laws Apply. My Students have the permission to copy.

    Java Script Tutorial

    Foreword

    Java Script is a scripting language that is widely used as programming tools in the webpages.
    With Java Script we can add simple and usual applications, like games, solving linear equatuoins, to our webpages. Other applications are specific to internet technology. Such applications include detection of browsers, popupmenus and other OnMouseOver and OnMouseOut capabilities.

    The Beginning

    Note that Javascript is not HTML, although it is used within HTML-files. The Javascript codes are written between the The <script> -tag .

    For example, if you write the following javascript code <form> <INPUT name="jvcrpt" type="button" value="CLICK for further Javascript effect" o nClick="alert('This is an Alert-Box. CLICK to PROCEED ');" > </form> then it produces the following effect on your screen.

    An Important Note: The javascript codes are included between

    <form> and </form> or between <script language="JavaScript"> and </script>

    Javascript Commands and Examples

    Following is a list of javascript commands followed by examples and links to explain their usage.

    1. document.write

      1. The Simple Use of "document.write"

    2. Use of bottons

      1. Use of buttons .

    3. alert

      1. The command "alert" is a vary commonly used javascript command. The box that poped up in beginning was created using this command. Let us look at some Simple Examples.
      2. Use of alert-command.

    4. confirm

      1. The command "confirm" is also a very commonly used javascript command and very similar to alert-command - both in usages and effect. Let us look at some Simple Examples.
      2. Use of confirm-command.


    5. prompt

      1. The command "prompt" is also a very commonly used javascript command and very similar to the alert and confirm command. Let us look at some Simple Examples.
      2. Use of prompt-comma nd.

    6. if ... else

      1. The use of if ... else is similar to any other programing language. Because of the following javascript script codes, the button and the corresponding effect appeared. <form> <INPUT name="ifelse" type="button" value="CLICK, I will tell you if 100 equal to 100" onClick="{if(100==100) alert('Yes, 100====100 as always. CLICK to PROCEED ');}" > </form>

      2. Another site on use of if ... else
      3. Another site on use of if ... else

    7. input

      An "INPUT" command has a type. Among the types I have seen are

      type="button", type="submit" type="hidden", type="text", type="radio".

      1. We have seen the use of "INPUT"-command with the bottons that was of the type="button". This type goes with alert command, confirm command, prompt command.
        The general syntax is: <form> <INPUT name="satya" type="button" value="dollar value" OnClick="action"> </form>
      2. With type="text" we get the following.
      3. With type="submit" we get the following.
      4. With type="hidden" we get the following.
      5. With type="radio" (twice) we get the following.
      6. In the following page we show how to play with "password"-type>

    8. onClick
      This "onClick"-command goes with the bottons and alert-, confirm-, prompt-boxes, that we have seen.

    9. onMouseOver and onMouseOut actions:
      These two commands or actions onMouseOver and OnMouseOut are very familiar to most users. I have two comments to make to begin with. First, These commands/actions always used with a link (<a href=></a>.) Sometimes, it is used with the empty link <a href ="#"></a> Second, this two are also used together. Usually, onMouseOver to do something and onMouseOut to undo. Now we have the following links for simple examples and oterwise.

      1. Some Simple Use of onMouseOver ans onMouseOut commands.
      2. Some Simple Use POP-UP-GIF on onMouseOver and onMouseOut commands. This one was done without use of functions.
      3. Some Simple Use POP-UP-GIF on onMouseOver and onMouseOut commands. This one was done with use of functions.
      4. Some Simple Use POP-UP-GIF on onMouseOver and onMouseOut commands. This one showing use of MULTIPLE GIFS.
      5. Some Trial Only .
      6. A site on Use of onMouseOver ans onMouseOut commands.
      7. A site on Use of onMou seOver ans onMouseOut commands.
    10. onFocus
    11. onBlur
    12. onChange
    13. onSelect
    14. onLoad
      The onLoad command asks the browser to do something when the user enters the page.

      1. We used onLoad command in our POP-UP-GIFS pages in the OnMouseOver and -Out section. We insert it on the body section as follows: <BODY onLoad="init()"> It asks the browser to call the function init() when loading is over. So that browser would know the value of the array menber menus[0].
      2. Here is another simple use of onLoad command.
      3. Here is YET another simple use of onLoad command.
    15. onUnload
    16. onSubmit

      1. A simple use of onSubmit Command
    17. Loops

      1. for
      2. while
      3. break
      4. continue
      The use of these 4 loop-commands in Java Script are similar other languages. Reader can look at the following links:

      1. A link for use of LOOPs in Java Script.



    USEFUL LINKS

    1. First Disable, Reset