JavaScript -- The Enbeded Java Language
 
  1. What is JavaScript
    1. A language based on java that can be embedded in web pages
    2. A language that good client programs know how to run (Netscape 2.0+ and IE3.0+)
    3. A language that has two main variants (Netscape's and Microsloths's)
    4. A way to add basic programming to a web page
    5. A way to add SERVER (not client) commands to a wweb page
  2. Is Javascript a standard?
    1. Yes, sort of.  Actually it was "turned over" to ECMA, the European Computing Machine Association

    2.           <http://www.ecma.ch>. They appear to be go-slow, secretive types. It remains to be seen
                whether this is a serious standardization effort, or a marketing ruse by Netscape to match
                Microsoft's dubious "turning over" of ActiveX to the X/Open Group.
  3. How does JavaScript work
    1. Page writer embeds commands in web page using <SCRIPT LANGUAGE=JavaScript></SCRIPT> tags
    2. Client runs the associated scripts
    3. Can have more than one script per page (all scripts in a page can share global variables)
    4. Client enforces security on scripts using the "sandbox" model.
  4. What is the Sandbox model?
    1. The sandbox is the place javascripts can play.  They are trapped in the sandbox and cannot access resources outside of the sandbox.
    2. No resource in the sandbox is vulnurable, or security is broken
    3. All invulnurable resources are in the sandbox, so the programs are maximally powerful
  5. What's NOT in the Sandbox?  What can a Javascript program NOT do?
    1. read or write random text files on the local disk or on the server
    2. invoke automatic printing of the current document  control browser e-mail, news reader, or bookmark windows and menus
    3. access or modify browser preferences settings
    4. capture a visitor's e-mail address or IP address
    5. quietly send me an e-mail when a visitor loads my page
    6.  launch client processes (e.g.,Unix sendmail,Win apps,Mac scripts)
    7. capture individual keystrokes
    8. change a document's background .gif after the page has loaded
    9. change the current browser window size, location, or options
    10. get rid of that dumb "JavaScript Alert:" line in alert dialogs
    11. Many of these items are possible in Netscape Communicator 4.0, which features the enhanced
      (and proprietary) version 1.2 of JavaScript. Moreover, those items perceived to be security risks
      (e.g., access browser settings) require "signed JavaScript."

      MSIE JScript v2 (more below) can read/write local files via ActiveX - a source of that
      architecture's widely publicized security pitfalls.

  6. What are some weird things I CAN do with JavaScript
    1. Open a navigator (but not MSIE) that is always minimized.
    2. Have one Navigator window control another.
    3. Execute code based on a timeout value (enter this form in 30 seconds, or ...)
    4. Access the status bar at the bottom of the screen (even in SCROLLER MODE if you want)

    5. Validate user imput before bothering the server like this (checks for an '@' in a supposed email address
    6. function test2(form) {

    7.   if (form.text2.value == "" || 
            form.text2.value.indexOf('@', 0) == -1) 
              alert("No valid e-mail address!");
        else alert("OK!");
      ...
      <input type="button" name="button2" value="Test Input" onClick="test2(this.form)">
       
    8. Move the focus where you want it (the most important field, the field with error, etc).
    9. Have a page that knows the current time and date (as seen by the client).
    10. Preload images (which slows startup but speed running)
    11. Have an image change just because the mouse cursor went over the image
    12. <a href="#" 
        onMouseOver="document.myImage2.src='img2.gif'" 
        onMouseOut="document.myImage2.src='img1.gif'">
      <img src="img1.gif" name="myImage2">
  7. Is Javascript compatable with Lite or with Perl?
    1. It is compatable with Lite.  Just include both.
    2. You can write a perl program that outputs javascript that gets run by the client.  Ifg you do you are either a hacker with great voodoo, or sick!
  8. Can you show me an example web page with Javascript?
    1.  
      <html> 
      <body> 
      <br> 
      This is a normal HTML document. 
      <br> 
        <script language="JavaScript"> 
          document.write("This is JavaScript!") 
        </script> 
      <br> 
      Back in HTML again. 
      </body> 
      </html>
       
  9. Can I keep my javascript code secret?
    1. Not at all.  It's write there in the page.  Just hit view source.
    2. It's less secret that Java, which only offers compiled *.class files to the client.  It's hard to modify a .class file, but easy to modify a Javascript.
  10. Can I keep my Javascript code copywrited?
    1. Jep, that's fine.  Legally yours, just not secret.
  11. Any Known Bugs?
    1. There is a known bug if the script occurs inside a table.  Better is to have the script write the table.
    2. MS's version for the Mac is not great, and incompatable with the Windows version (who'd a thought).
    3. MSIE allows only one cookie per document, but Netscape allows 20.  Go figure!!