<SCRIPT LANGUAGE="language" [SRC=url] >

Contents


Structure of inline code

  <SCRIPT LANGUAGE="language" >
  Any information going here will be seen (!) by non-Script-aware clients.
  It is recommended that no information go here.

  <!-- --> As a new convention, any information on these lines is
  <!-- --> ignored by SCRIPT-aware clients. 

  <!--
     Here goes information that will only be seen by
     Script-aware clients. This is where the majority of script
     functions should go
  <!-- --> This construct also ends a Script block.
  </SCRIPT>


Comments

Tags that are not recognized by browsers are usually ignored, so in the case of SCRIPT deficient browsers the code held between the <SCRIPT> .... </SCRIPT>.

Using comments prevents accidental display of SCRIPT code to non SCRIPT aware browsers.


processing

SCRIPTS tags are processed immediately when a document is loaded. The code is compiled but will not be executed unless Here is a brief example:
  <HTML>
  <HEAD>
  <SCRIPT LANGUAGE="NSL">
  <!-
      // generate some HTML just for kicks 
      function ack(i, j) 
      {
         write("ack(" + i + ", " + j + ")<BR>")
         if (i == 0) return j + 1
         if (j == 0) return ack(i-1, 1)
         return ack(i-1, ack(i, j-1))
      }

      // and execute.. normally you would use an event
      write(ack(3,3))
  ->
  </SCRIPT>
  </HEAD>
  <BODY>
  You have just seen a printout of Ackerman's Function
  </BODY>
  </HTML>

events

events

Object Level (<INPUT>)
OnFocus Control got focus
OnBlurr Control lost focus
OnSelect The text field was selected
OnChange Value of (in) field changed
OnSubmit Submit button was pressed
OnClick The button was pressed
Page level (<BODY>)
OnClose Current url was overwritten by another
OnOpen url just opened in a frame (or window>

Invoking scripts

Script functions can also be invoked from event attributes inserted into elements of the BODY.
   <HTML>
   <HEAD>
   <SCRIPT LANGUAGE="NSL" SRC=checkNumber.NSL> </SCRIPT>
   </HEAD>
   <BODY>
   <FORM ACTION="http://aubrey/form.html" METHOD="get">
   Please enter a quantity:
   <input 
      name=quantity 
      onClose="checkNumber(this.value, 1, 10, 'Enter a number between 1 and 10')" 
      value="0">
   </FORM>
   </BODY>
   </HTML>