SlideShare a Scribd company logo
Programming on the Web(CSC309F)


     Tutorial 5: JAVASCRIPT
      TA:Wael Abouelsaadat
  WebSite:   http://www.cs.toronto.edu/~wael

   Office-Hour: Friday 12:00-1:00 (SF2110)

        Email: wael@cs.toronto.edu




                                               1
JavaScript

Ø JavaScript vs. JScript:
     § Jscript Homepage:    http://msdn.microsoft.com/scripting/default.htm
     § JavaScript Homepage: http://developer.netscape.com/tech/javascript/index.html

ØJavaScript Built-in Data Types:
    § Boolean (true or false)
    § Null
    § Number ( double-precision 64-bit format)
    § Object (encompassing the Array object)
    § String
    § Undefined

Ø JavaScript Built-in Objects:

                     Array1              Boolean             Date                  Error2
                     EvalError2          Function1           Math                  Number1
                     Object1             RangeError2         ReferenceError2       RegExp 3

                     String1             SyntaxError2        TypeError2            URIError2
                               (1) ECMA Level 1      (2) ECMA Level 2   (3) ECMA Level 3




                                                                                               2
JavaScript Built-in Objects

Ø String Object:
     § Properties:
           • constructor                                    length                                    prototype

     § Methods:
          • charAt( index )                                 charCodeAt([index])                       concat( string2)
              indexOf( SearchString, StartIndex )           lastIndexOf( searchString, StartIndex )   localeCompare( string2 )
              match( regExpression )                        replace( regExpression, replaceString)    slice( startIndex, endIndex )
              split( “delimiterCharacter”, limitInteger )   substr( start, length )                   substring( indexA, indexB )
              toLocaleLowerCase( )                          toLocaleUpperCase( )                      toLowerCase( )
              toUpperCase()                                 toString()                                valueOf()

     § Formatting methods:
          • anchor( “anchorName”),                          blink( )                                  bold( )
              fixed()                                       fontcolor(colorValue)                     fontsize( integer1-7)
              italics()                                     link( locationOrURL)                      big()
              small()                                       strike()                                  sub(), sup()


     § Special inline characters:
           • ” Double quote                                ’ Single quote                            Blackslash
             b Backspace                                   t tab                                    n new line
             r Carriage return                             f form feed




                                                                                                                                      3
JavaScript Built-in Objects

Ø Math Object:
    § Properties:
            • E( Euler’s constant)                  LN2(Natural log of 2)      LN10(natural log of 10)
              LOG2E(log base-2 of E)                LOG10E(log base-10 of E)   PI
              SQRT1_2( square root of 0.5)          SQRT2(square root of 2)

     § Methods:
          • abs( value )                            acos( value )              asin( value )
              atan( value )                         atan2( value1, value2 )    ceil( value )
              cos( value )                          exp( value )               floor( value )
              log( value )                          max( value1, value2 )      min( value1, value2 )
              pow( value1, value2 )                 random( )                  round( value )
              sin( value )                          sqrt( value )              tan( value )


Ø Number Object:
    • Properties:
            • constructor                           MAX_VALUE                  MIN_VALUE
              NaN                                   NEGATIVE_INFINITY          POSITIVE_INIFINITY
              prototype

     § Methods:
          • toExponential( value )                  toFixed( value )           toLocaleString( value )
              toString( value )                     toPrecision( )             valueOf( )




                                                                                                         4
JavaScript Built-in Objects (cont’d)
Ø Boolean Object:
    • Properties:
          • constructor                       prototype

     § Methods:
          • toString( BooleanValue )          valueOf( )


Ø Date Object:
    § Methods:
          • getFullYear( )                    getYear( )                         getMonth( )
            getDate( )                        getDay( )                          getHours( )
            getMinutes( )                     getSeconds( value )                getTime( value )
            getMilliseconds( )                getUTCFullYear( value1, value2 )   getUTCMonth( value1, value2 )
            getUTCDate( value1, value2 )      getUTCDay( )                       getUTCHours( value )
            getUTCMinutes( )                  getUTCSeconds( )                   tgetUTCMilliseconds( )
            setYear( value )                  setFullYear( value )               setMonth( value )
            setDate ( value )                 setHours( value )                  setMinutes( value )
            setSeconds( value )               setMilliseconds( value )           setTime( value )
            setUTCFullYear( value )           setUTCMonth( value )               setUTCDate ( value )
            setUTCHours( value )              setUTCMinutes( value )             setUTCSeconds( value )
            setUTCMilliseconds( value )       getTimezoneOffset( )               toDateString( )
            toGMTString( )                    toLocaleString( )                  toLocateTimeString( )
            toString( )                       toTimeString( )                    toUTCString( )
            parse( “a date string”)           UTC( date values )




                                                                                                           5
JavaScript Built-in Objects (cont’d)
Ø Array Object:
    • Properties:
          • constructor                               prototype

     § Methods:
          • concat( array2 )                          join( SeparatorString )          pop( )
            push( value or Object )                   shift( )                         unshift( )
            reverse( )                                slice( StartIndex , EndIndex )   sort( compareFunction )
            splice( StartIndex, DeleteCount, item )   toLocaleString                   toString( )




                                                                                                                 6
JavaScript Control Structures
Ø If… Else:          var boolChecked = new Boolean( true );
                     if( boolChecked.valueof( ) ){
                     }
Ø for Loops:         var nIndex, nCount = 10;
                     for( var nIndex= 0; nIndex < nCount ; nIndex++ ) {
                         // statements
                     }
Ø while Loops:       var nIndex, nCount = 10;
                     while( nIndex < nCount ) {
                        // statements
                         nIndex++;
                     }
Ø do-while Loops:    var nIndex, nCount = 10;
                     do{
                        // statements
                        nIndex++;
                     } while(nIndex < nCount )
Ø with Statement:    function seeColor( form )
                        with( form.colorsList ){
                           newColor = (options[selectedIndex].text);
                        }
                     }
Øswitch Statement:   switch( nPrice ){
                       case 10: // statements
                                  break;
                       case 20: // statements
                                  break;
                       default: // statements                             7
                     }
JavaScript Operators
Ø Comparison Operators:
         == , != , === (strictly equals), !== (strictly does not equal), > , >=, < , <=

Ø Connubial Operators:
          +, -, *, /, % (module), ++, --, +value, -value

Ø Assignment Operators:
         =, +=, -=, *=, /=, %=, <<=, >=, >>=, >>>=, &=, |=, ^=

Ø Boolean Operators:
          &&, ||, !

Ø Bitwise Operators:
           &, |, ^, ~, <<, >>, >>>

Ø Object Operators:
          delete, in, instanceof, new, this

Ø Other Operators:
          typeof, void




                                                                                          8
JavaScript Global Functions and Statements
Ø Global Functions:
    § decodeURI( “encodedURI” )
    § decodeURIComponent(“encodedURIComponent” )
    § encodeURI( “URIString” )
    § encodeURIComponent( “URIComponentString” )
    § escape( “URIString” )
    § unescape( “escapedURIString” )
    § eval( “string” )                // evaluate any JavaScript statement or expression stored as string
    § isFinite( number )              // checks if number is beyond JavaScript ability to handle
    § isNan( expression )             // tests whether a value is a number or not
    § Number( “string” )              // converts a string to a numeric value
    § parseFloat( “string” )          // converts a string to a float
    § parseInt( “string” , radix )    // converts a string to an integer
    § toString( )                     // returns a string representation
    § unwatch( )                      // for debugging purposes
    § watch( )                        // for debugging purposes

Ø Statements:
     § const                                                      // e.g. const FREEZING_F = 32;
     § var                                                        // e.g.: var temperature = 32;
     § // comments



                                                                                                 9
JavaScript Events
Event         Supported By
OnAbort       Image
OnBlur        Button, Checkbox, FileUpload, Layer, Password,Radio, Reset, Select, Submit, Text, TextArea, Window.
OnChange      Select, text, input elements
OnClick       Select, text, input elements
onDblClick    Document, image button elements, Link
onDragDrop    Window elements
onError       Image, Window
onFocus       Button, Checkbox, FileUpload, Password, Radio, Reset, Select, Submit, Text, TextArea, Window.
onKeyDown     Document, Image, Link, TextArea.
onKeyPress    Document, Image, Link, TextArea
onKeyUp       Document, Image, Link, TextArea
onload        Image, Window.
onMouseDown   Button, Document, Link
onMouseOut    Layer, link, image
onMouseOver   Layer, link, image
onMouseUp     Document, image, button elements, link
onMove        Window
onReset       Form
onResize      Window
onSelect      Text, textarea

onSubmit      Form
                                                                                                                    10
onUnload      Window
JavaScript – Applet Communication
Ø test.html
              <html>
              <head><title>test</title></head>
              <body>
                   <h1>This is a test of applets</h1>
                   <hr></hr>
                   <applet name="testapplet" code="TestApplet.class" height="300" width="300">
                             <param name="text" value="Grizzly Dave!"></param>
                             Text displayed by non-java enabled browsers
                   </applet>
                   <hr></hr>
                   <form>
                             <input type="button“ onclick="alert(document.testapplet.getText())“ value="Get Data From Applet">
                   </form>
              </body>
              </html>
Ø TestApplet.java
              import java.applet.*;
              import java.awt.*;

              public class TestApplet extends Applet {
                 String text = "error";
                 public void init() {
                    text = getParameter("text");
                 }
                 public void paint(Graphics g) {
                  g.drawString(text,50,50);
                 }
                public String getText() {
                  return text;
                }
              }                                                                                                                  11
DOM Hierarchy
                                                                        Window
                                                                  (frame,self,top,parent)




            navigator              screen               history                 document                     location            event




             link         stylesheets              applets             form                 images               plugins         embeds



    anchor                                                                                                                                   all
                        textarea            text              radio            button                reset              select


selection
                                                                                                                                          [elements]
                                                                                                                        option
                                                   password            checkbox             submit


                                                                                                                                             style




                                                                                                                                           12
Sites:

Ø JavaScript
     § http://developer.netscape.com/docs/manuals/javascript.html
     § http://www.gatescript.com/
     § http://www.devguru.com/Technologies/ecmascript/quickref/javascript_intro.html
     § http://webdeveloper.earthweb.com/webjs/
     § http://www.jsworld.com/


Ø Dynamic HTML
    § http://www.dynamicdrive.com/
    § http://www.htmlguru.com/guru.html
    § http://www.w3schools.com/dhtml/




                                                                                       13

More Related Content

What's hot

深入浅出Jscex
深入浅出Jscex深入浅出Jscex
深入浅出Jscex
jeffz
 
Codemash-Clojure.pdf
Codemash-Clojure.pdfCodemash-Clojure.pdf
Codemash-Clojure.pdf
Howard Lewis Ship
 
Jscex: Write Sexy JavaScript
Jscex: Write Sexy JavaScriptJscex: Write Sexy JavaScript
Jscex: Write Sexy JavaScript
jeffz
 
DevFest Istanbul - a free guided tour of Neo4J
DevFest Istanbul - a free guided tour of Neo4JDevFest Istanbul - a free guided tour of Neo4J
DevFest Istanbul - a free guided tour of Neo4J
Florent Biville
 
Scala in Places API
Scala in Places APIScala in Places API
Scala in Places API
Łukasz Bałamut
 
Coding in Style
Coding in StyleCoding in Style
Coding in Style
scalaconfjp
 
Clojure And Swing
Clojure And SwingClojure And Swing
Clojure And Swing
Skills Matter
 
Grammarware Memes
Grammarware MemesGrammarware Memes
Grammarware Memes
Eelco Visser
 
20070329 Java Programing Tips
20070329 Java Programing Tips20070329 Java Programing Tips
20070329 Java Programing Tips
Shingo Furuyama
 
Node 관계형 데이터베이스_바인딩
Node 관계형 데이터베이스_바인딩Node 관계형 데이터베이스_바인딩
Node 관계형 데이터베이스_바인딩
HyeonSeok Choi
 
Soft Shake Event / A soft introduction to Neo4J
Soft Shake Event / A soft introduction to Neo4JSoft Shake Event / A soft introduction to Neo4J
Soft Shake Event / A soft introduction to Neo4J
Florent Biville
 
Dart
DartDart
Dart
anandvns
 
Breaking the wall
Breaking the wallBreaking the wall
Breaking the wall
Taras Kalapun
 
MongoDB Live Hacking
MongoDB Live HackingMongoDB Live Hacking
MongoDB Live Hacking
Tobias Trelle
 
スマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみた
スマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみたスマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみた
スマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみた
Taro Matsuzawa
 
Scala for Java programmers
Scala for Java programmersScala for Java programmers
Scala for Java programmers
輝 子安
 
Groovy intro for OUDL
Groovy intro for OUDLGroovy intro for OUDL
Groovy intro for OUDL
J David Beutel
 
Scala-对Java的修正和超越
Scala-对Java的修正和超越Scala-对Java的修正和超越
Scala-对Java的修正和超越
Caoyuan Deng
 
Mary Had a Little λ (QCon)
Mary Had a Little λ (QCon)Mary Had a Little λ (QCon)
Mary Had a Little λ (QCon)
Stephen Chin
 
V8
V8V8

What's hot (20)

深入浅出Jscex
深入浅出Jscex深入浅出Jscex
深入浅出Jscex
 
Codemash-Clojure.pdf
Codemash-Clojure.pdfCodemash-Clojure.pdf
Codemash-Clojure.pdf
 
Jscex: Write Sexy JavaScript
Jscex: Write Sexy JavaScriptJscex: Write Sexy JavaScript
Jscex: Write Sexy JavaScript
 
DevFest Istanbul - a free guided tour of Neo4J
DevFest Istanbul - a free guided tour of Neo4JDevFest Istanbul - a free guided tour of Neo4J
DevFest Istanbul - a free guided tour of Neo4J
 
Scala in Places API
Scala in Places APIScala in Places API
Scala in Places API
 
Coding in Style
Coding in StyleCoding in Style
Coding in Style
 
Clojure And Swing
Clojure And SwingClojure And Swing
Clojure And Swing
 
Grammarware Memes
Grammarware MemesGrammarware Memes
Grammarware Memes
 
20070329 Java Programing Tips
20070329 Java Programing Tips20070329 Java Programing Tips
20070329 Java Programing Tips
 
Node 관계형 데이터베이스_바인딩
Node 관계형 데이터베이스_바인딩Node 관계형 데이터베이스_바인딩
Node 관계형 데이터베이스_바인딩
 
Soft Shake Event / A soft introduction to Neo4J
Soft Shake Event / A soft introduction to Neo4JSoft Shake Event / A soft introduction to Neo4J
Soft Shake Event / A soft introduction to Neo4J
 
Dart
DartDart
Dart
 
Breaking the wall
Breaking the wallBreaking the wall
Breaking the wall
 
MongoDB Live Hacking
MongoDB Live HackingMongoDB Live Hacking
MongoDB Live Hacking
 
スマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみた
スマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみたスマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみた
スマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみた
 
Scala for Java programmers
Scala for Java programmersScala for Java programmers
Scala for Java programmers
 
Groovy intro for OUDL
Groovy intro for OUDLGroovy intro for OUDL
Groovy intro for OUDL
 
Scala-对Java的修正和超越
Scala-对Java的修正和超越Scala-对Java的修正和超越
Scala-对Java的修正和超越
 
Mary Had a Little λ (QCon)
Mary Had a Little λ (QCon)Mary Had a Little λ (QCon)
Mary Had a Little λ (QCon)
 
V8
V8V8
V8
 

Viewers also liked

Indian spirituality
Indian spiritualityIndian spirituality
Indian spirituality
Boo Yeang Khoo
 
Marshall.monday
Marshall.mondayMarshall.monday
Marshall.mondaynado-web
 
Plagio. udea
Plagio. udeaPlagio. udea
Plagio. udea
herreralaura731
 
Component Framework Primer for JSF Users
Component Framework Primer for JSF UsersComponent Framework Primer for JSF Users
Component Framework Primer for JSF Users
Andy Schwartz
 
Adv html
Adv htmlAdv html
RCEC Email 4.7.03 (b)
RCEC Email 4.7.03 (b)RCEC Email 4.7.03 (b)
RCEC Email 4.7.03 (b)
Obama White House
 
Advisor Jumpstart: JavaScript
Advisor Jumpstart: JavaScriptAdvisor Jumpstart: JavaScript
Advisor Jumpstart: JavaScript
dominion
 

Viewers also liked (7)

Indian spirituality
Indian spiritualityIndian spirituality
Indian spirituality
 
Marshall.monday
Marshall.mondayMarshall.monday
Marshall.monday
 
Plagio. udea
Plagio. udeaPlagio. udea
Plagio. udea
 
Component Framework Primer for JSF Users
Component Framework Primer for JSF UsersComponent Framework Primer for JSF Users
Component Framework Primer for JSF Users
 
Adv html
Adv htmlAdv html
Adv html
 
RCEC Email 4.7.03 (b)
RCEC Email 4.7.03 (b)RCEC Email 4.7.03 (b)
RCEC Email 4.7.03 (b)
 
Advisor Jumpstart: JavaScript
Advisor Jumpstart: JavaScriptAdvisor Jumpstart: JavaScript
Advisor Jumpstart: JavaScript
 

Similar to tutorial5

楽々Scalaプログラミング
楽々Scalaプログラミング楽々Scalaプログラミング
楽々Scalaプログラミング
Tomoharu ASAMI
 
Spark schema for free with David Szakallas
Spark schema for free with David SzakallasSpark schema for free with David Szakallas
Spark schema for free with David Szakallas
Databricks
 
Coq to Rubyによる証明駆動開発@名古屋ruby会議02
Coq to Rubyによる証明駆動開発@名古屋ruby会議02Coq to Rubyによる証明駆動開発@名古屋ruby会議02
Coq to Rubyによる証明駆動開発@名古屋ruby会議02
Hiroki Mizuno
 
Robust Operations of Kafka Streams
Robust Operations of Kafka StreamsRobust Operations of Kafka Streams
Robust Operations of Kafka Streams
confluent
 
第7回みゆっき☆Think 本気で学ぶ JavaScript
第7回みゆっき☆Think 本気で学ぶ JavaScript第7回みゆっき☆Think 本気で学ぶ JavaScript
第7回みゆっき☆Think 本気で学ぶ JavaScript
Takuya Fujimura
 
みゆっき☆Think#7 「本気で学ぶJavascript」
みゆっき☆Think#7 「本気で学ぶJavascript」みゆっき☆Think#7 「本気で学ぶJavascript」
みゆっき☆Think#7 「本気で学ぶJavascript」
techtalkdwango
 
Scala introduction
Scala introductionScala introduction
Scala introduction
vito jeng
 
Meta-objective Lisp @名古屋 Reject 会議
Meta-objective Lisp @名古屋 Reject 会議Meta-objective Lisp @名古屋 Reject 会議
Meta-objective Lisp @名古屋 Reject 会議
dico_leque
 
SVGo: a Go Library for SVG generation
SVGo: a Go Library for SVG generationSVGo: a Go Library for SVG generation
SVGo: a Go Library for SVG generation
Anthony Starks
 
Angular2 for Beginners
Angular2 for BeginnersAngular2 for Beginners
Angular2 for Beginners
Oswald Campesato
 
Java Script Workshop
Java Script WorkshopJava Script Workshop
Java Script Workshop
Dmitry Baranovskiy
 
Serializing EMF models with Xtext
Serializing EMF models with XtextSerializing EMF models with Xtext
Serializing EMF models with Xtext
meysholdt
 
Lisp Macros in 20 Minutes (Featuring Clojure)
Lisp Macros in 20 Minutes (Featuring Clojure)Lisp Macros in 20 Minutes (Featuring Clojure)
Lisp Macros in 20 Minutes (Featuring Clojure)
Phil Calçado
 
Coding for
Coding for Coding for
Coding for
David Gelb
 
MongoDB + node.js で作るソーシャルゲーム
MongoDB + node.js で作るソーシャルゲームMongoDB + node.js で作るソーシャルゲーム
MongoDB + node.js で作るソーシャルゲーム
Suguru Namura
 
Continuation Passing Style and Macros in Clojure - Jan 2012
Continuation Passing Style and Macros in Clojure - Jan 2012Continuation Passing Style and Macros in Clojure - Jan 2012
Continuation Passing Style and Macros in Clojure - Jan 2012
Leonardo Borges
 
Command Liner with Scala
Command Liner with ScalaCommand Liner with Scala
Command Liner with Scala
なんとか くら
 
SVGo workshop
SVGo workshopSVGo workshop
SVGo workshop
Anthony Starks
 
Spark Summit EU talk by Ted Malaska
Spark Summit EU talk by Ted MalaskaSpark Summit EU talk by Ted Malaska
Spark Summit EU talk by Ted Malaska
Spark Summit
 
Introduction to Scalding and Monoids
Introduction to Scalding and MonoidsIntroduction to Scalding and Monoids
Introduction to Scalding and Monoids
Hugo Gävert
 

Similar to tutorial5 (20)

楽々Scalaプログラミング
楽々Scalaプログラミング楽々Scalaプログラミング
楽々Scalaプログラミング
 
Spark schema for free with David Szakallas
Spark schema for free with David SzakallasSpark schema for free with David Szakallas
Spark schema for free with David Szakallas
 
Coq to Rubyによる証明駆動開発@名古屋ruby会議02
Coq to Rubyによる証明駆動開発@名古屋ruby会議02Coq to Rubyによる証明駆動開発@名古屋ruby会議02
Coq to Rubyによる証明駆動開発@名古屋ruby会議02
 
Robust Operations of Kafka Streams
Robust Operations of Kafka StreamsRobust Operations of Kafka Streams
Robust Operations of Kafka Streams
 
第7回みゆっき☆Think 本気で学ぶ JavaScript
第7回みゆっき☆Think 本気で学ぶ JavaScript第7回みゆっき☆Think 本気で学ぶ JavaScript
第7回みゆっき☆Think 本気で学ぶ JavaScript
 
みゆっき☆Think#7 「本気で学ぶJavascript」
みゆっき☆Think#7 「本気で学ぶJavascript」みゆっき☆Think#7 「本気で学ぶJavascript」
みゆっき☆Think#7 「本気で学ぶJavascript」
 
Scala introduction
Scala introductionScala introduction
Scala introduction
 
Meta-objective Lisp @名古屋 Reject 会議
Meta-objective Lisp @名古屋 Reject 会議Meta-objective Lisp @名古屋 Reject 会議
Meta-objective Lisp @名古屋 Reject 会議
 
SVGo: a Go Library for SVG generation
SVGo: a Go Library for SVG generationSVGo: a Go Library for SVG generation
SVGo: a Go Library for SVG generation
 
Angular2 for Beginners
Angular2 for BeginnersAngular2 for Beginners
Angular2 for Beginners
 
Java Script Workshop
Java Script WorkshopJava Script Workshop
Java Script Workshop
 
Serializing EMF models with Xtext
Serializing EMF models with XtextSerializing EMF models with Xtext
Serializing EMF models with Xtext
 
Lisp Macros in 20 Minutes (Featuring Clojure)
Lisp Macros in 20 Minutes (Featuring Clojure)Lisp Macros in 20 Minutes (Featuring Clojure)
Lisp Macros in 20 Minutes (Featuring Clojure)
 
Coding for
Coding for Coding for
Coding for
 
MongoDB + node.js で作るソーシャルゲーム
MongoDB + node.js で作るソーシャルゲームMongoDB + node.js で作るソーシャルゲーム
MongoDB + node.js で作るソーシャルゲーム
 
Continuation Passing Style and Macros in Clojure - Jan 2012
Continuation Passing Style and Macros in Clojure - Jan 2012Continuation Passing Style and Macros in Clojure - Jan 2012
Continuation Passing Style and Macros in Clojure - Jan 2012
 
Command Liner with Scala
Command Liner with ScalaCommand Liner with Scala
Command Liner with Scala
 
SVGo workshop
SVGo workshopSVGo workshop
SVGo workshop
 
Spark Summit EU talk by Ted Malaska
Spark Summit EU talk by Ted MalaskaSpark Summit EU talk by Ted Malaska
Spark Summit EU talk by Ted Malaska
 
Introduction to Scalding and Monoids
Introduction to Scalding and MonoidsIntroduction to Scalding and Monoids
Introduction to Scalding and Monoids
 

More from tutorialsruby

&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
tutorialsruby
 
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
tutorialsruby
 
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
tutorialsruby
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
tutorialsruby
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
tutorialsruby
 
Standardization and Knowledge Transfer – INS0
Standardization and Knowledge Transfer – INS0Standardization and Knowledge Transfer – INS0
Standardization and Knowledge Transfer – INS0
tutorialsruby
 
xhtml_basics
xhtml_basicsxhtml_basics
xhtml_basics
tutorialsruby
 
xhtml_basics
xhtml_basicsxhtml_basics
xhtml_basics
tutorialsruby
 
xhtml-documentation
xhtml-documentationxhtml-documentation
xhtml-documentation
tutorialsruby
 
xhtml-documentation
xhtml-documentationxhtml-documentation
xhtml-documentation
tutorialsruby
 
CSS
CSSCSS
CSS
CSSCSS
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa0602690047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
tutorialsruby
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa0602690047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
tutorialsruby
 
HowTo_CSS
HowTo_CSSHowTo_CSS
HowTo_CSS
tutorialsruby
 
HowTo_CSS
HowTo_CSSHowTo_CSS
HowTo_CSS
tutorialsruby
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008
tutorialsruby
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008
tutorialsruby
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheets
tutorialsruby
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheets
tutorialsruby
 

More from tutorialsruby (20)

&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
 
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
Standardization and Knowledge Transfer – INS0
Standardization and Knowledge Transfer – INS0Standardization and Knowledge Transfer – INS0
Standardization and Knowledge Transfer – INS0
 
xhtml_basics
xhtml_basicsxhtml_basics
xhtml_basics
 
xhtml_basics
xhtml_basicsxhtml_basics
xhtml_basics
 
xhtml-documentation
xhtml-documentationxhtml-documentation
xhtml-documentation
 
xhtml-documentation
xhtml-documentationxhtml-documentation
xhtml-documentation
 
CSS
CSSCSS
CSS
 
CSS
CSSCSS
CSS
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa0602690047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa0602690047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
 
HowTo_CSS
HowTo_CSSHowTo_CSS
HowTo_CSS
 
HowTo_CSS
HowTo_CSSHowTo_CSS
HowTo_CSS
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheets
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheets
 

Recently uploaded

Webinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data WarehouseWebinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data Warehouse
Federico Razzoli
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
Mariano Tinti
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
David Brossard
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
Project Management Semester Long Project - Acuity
Project Management Semester Long Project - AcuityProject Management Semester Long Project - Acuity
Project Management Semester Long Project - Acuity
jpupo2018
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Wask
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 

Recently uploaded (20)

Webinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data WarehouseWebinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data Warehouse
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
Project Management Semester Long Project - Acuity
Project Management Semester Long Project - AcuityProject Management Semester Long Project - Acuity
Project Management Semester Long Project - Acuity
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 

tutorial5

  • 1. Programming on the Web(CSC309F) Tutorial 5: JAVASCRIPT TA:Wael Abouelsaadat WebSite: http://www.cs.toronto.edu/~wael Office-Hour: Friday 12:00-1:00 (SF2110) Email: wael@cs.toronto.edu 1
  • 2. JavaScript Ø JavaScript vs. JScript: § Jscript Homepage: http://msdn.microsoft.com/scripting/default.htm § JavaScript Homepage: http://developer.netscape.com/tech/javascript/index.html ØJavaScript Built-in Data Types: § Boolean (true or false) § Null § Number ( double-precision 64-bit format) § Object (encompassing the Array object) § String § Undefined Ø JavaScript Built-in Objects: Array1 Boolean Date Error2 EvalError2 Function1 Math Number1 Object1 RangeError2 ReferenceError2 RegExp 3 String1 SyntaxError2 TypeError2 URIError2 (1) ECMA Level 1 (2) ECMA Level 2 (3) ECMA Level 3 2
  • 3. JavaScript Built-in Objects Ø String Object: § Properties: • constructor length prototype § Methods: • charAt( index ) charCodeAt([index]) concat( string2) indexOf( SearchString, StartIndex ) lastIndexOf( searchString, StartIndex ) localeCompare( string2 ) match( regExpression ) replace( regExpression, replaceString) slice( startIndex, endIndex ) split( “delimiterCharacter”, limitInteger ) substr( start, length ) substring( indexA, indexB ) toLocaleLowerCase( ) toLocaleUpperCase( ) toLowerCase( ) toUpperCase() toString() valueOf() § Formatting methods: • anchor( “anchorName”), blink( ) bold( ) fixed() fontcolor(colorValue) fontsize( integer1-7) italics() link( locationOrURL) big() small() strike() sub(), sup() § Special inline characters: • ” Double quote ’ Single quote Blackslash b Backspace t tab n new line r Carriage return f form feed 3
  • 4. JavaScript Built-in Objects Ø Math Object: § Properties: • E( Euler’s constant) LN2(Natural log of 2) LN10(natural log of 10) LOG2E(log base-2 of E) LOG10E(log base-10 of E) PI SQRT1_2( square root of 0.5) SQRT2(square root of 2) § Methods: • abs( value ) acos( value ) asin( value ) atan( value ) atan2( value1, value2 ) ceil( value ) cos( value ) exp( value ) floor( value ) log( value ) max( value1, value2 ) min( value1, value2 ) pow( value1, value2 ) random( ) round( value ) sin( value ) sqrt( value ) tan( value ) Ø Number Object: • Properties: • constructor MAX_VALUE MIN_VALUE NaN NEGATIVE_INFINITY POSITIVE_INIFINITY prototype § Methods: • toExponential( value ) toFixed( value ) toLocaleString( value ) toString( value ) toPrecision( ) valueOf( ) 4
  • 5. JavaScript Built-in Objects (cont’d) Ø Boolean Object: • Properties: • constructor prototype § Methods: • toString( BooleanValue ) valueOf( ) Ø Date Object: § Methods: • getFullYear( ) getYear( ) getMonth( ) getDate( ) getDay( ) getHours( ) getMinutes( ) getSeconds( value ) getTime( value ) getMilliseconds( ) getUTCFullYear( value1, value2 ) getUTCMonth( value1, value2 ) getUTCDate( value1, value2 ) getUTCDay( ) getUTCHours( value ) getUTCMinutes( ) getUTCSeconds( ) tgetUTCMilliseconds( ) setYear( value ) setFullYear( value ) setMonth( value ) setDate ( value ) setHours( value ) setMinutes( value ) setSeconds( value ) setMilliseconds( value ) setTime( value ) setUTCFullYear( value ) setUTCMonth( value ) setUTCDate ( value ) setUTCHours( value ) setUTCMinutes( value ) setUTCSeconds( value ) setUTCMilliseconds( value ) getTimezoneOffset( ) toDateString( ) toGMTString( ) toLocaleString( ) toLocateTimeString( ) toString( ) toTimeString( ) toUTCString( ) parse( “a date string”) UTC( date values ) 5
  • 6. JavaScript Built-in Objects (cont’d) Ø Array Object: • Properties: • constructor prototype § Methods: • concat( array2 ) join( SeparatorString ) pop( ) push( value or Object ) shift( ) unshift( ) reverse( ) slice( StartIndex , EndIndex ) sort( compareFunction ) splice( StartIndex, DeleteCount, item ) toLocaleString toString( ) 6
  • 7. JavaScript Control Structures Ø If… Else: var boolChecked = new Boolean( true ); if( boolChecked.valueof( ) ){ } Ø for Loops: var nIndex, nCount = 10; for( var nIndex= 0; nIndex < nCount ; nIndex++ ) { // statements } Ø while Loops: var nIndex, nCount = 10; while( nIndex < nCount ) { // statements nIndex++; } Ø do-while Loops: var nIndex, nCount = 10; do{ // statements nIndex++; } while(nIndex < nCount ) Ø with Statement: function seeColor( form ) with( form.colorsList ){ newColor = (options[selectedIndex].text); } } Øswitch Statement: switch( nPrice ){ case 10: // statements break; case 20: // statements break; default: // statements 7 }
  • 8. JavaScript Operators Ø Comparison Operators: == , != , === (strictly equals), !== (strictly does not equal), > , >=, < , <= Ø Connubial Operators: +, -, *, /, % (module), ++, --, +value, -value Ø Assignment Operators: =, +=, -=, *=, /=, %=, <<=, >=, >>=, >>>=, &=, |=, ^= Ø Boolean Operators: &&, ||, ! Ø Bitwise Operators: &, |, ^, ~, <<, >>, >>> Ø Object Operators: delete, in, instanceof, new, this Ø Other Operators: typeof, void 8
  • 9. JavaScript Global Functions and Statements Ø Global Functions: § decodeURI( “encodedURI” ) § decodeURIComponent(“encodedURIComponent” ) § encodeURI( “URIString” ) § encodeURIComponent( “URIComponentString” ) § escape( “URIString” ) § unescape( “escapedURIString” ) § eval( “string” ) // evaluate any JavaScript statement or expression stored as string § isFinite( number ) // checks if number is beyond JavaScript ability to handle § isNan( expression ) // tests whether a value is a number or not § Number( “string” ) // converts a string to a numeric value § parseFloat( “string” ) // converts a string to a float § parseInt( “string” , radix ) // converts a string to an integer § toString( ) // returns a string representation § unwatch( ) // for debugging purposes § watch( ) // for debugging purposes Ø Statements: § const // e.g. const FREEZING_F = 32; § var // e.g.: var temperature = 32; § // comments 9
  • 10. JavaScript Events Event Supported By OnAbort Image OnBlur Button, Checkbox, FileUpload, Layer, Password,Radio, Reset, Select, Submit, Text, TextArea, Window. OnChange Select, text, input elements OnClick Select, text, input elements onDblClick Document, image button elements, Link onDragDrop Window elements onError Image, Window onFocus Button, Checkbox, FileUpload, Password, Radio, Reset, Select, Submit, Text, TextArea, Window. onKeyDown Document, Image, Link, TextArea. onKeyPress Document, Image, Link, TextArea onKeyUp Document, Image, Link, TextArea onload Image, Window. onMouseDown Button, Document, Link onMouseOut Layer, link, image onMouseOver Layer, link, image onMouseUp Document, image, button elements, link onMove Window onReset Form onResize Window onSelect Text, textarea onSubmit Form 10 onUnload Window
  • 11. JavaScript – Applet Communication Ø test.html <html> <head><title>test</title></head> <body> <h1>This is a test of applets</h1> <hr></hr> <applet name="testapplet" code="TestApplet.class" height="300" width="300"> <param name="text" value="Grizzly Dave!"></param> Text displayed by non-java enabled browsers </applet> <hr></hr> <form> <input type="button“ onclick="alert(document.testapplet.getText())“ value="Get Data From Applet"> </form> </body> </html> Ø TestApplet.java import java.applet.*; import java.awt.*; public class TestApplet extends Applet { String text = "error"; public void init() { text = getParameter("text"); } public void paint(Graphics g) { g.drawString(text,50,50); } public String getText() { return text; } } 11
  • 12. DOM Hierarchy Window (frame,self,top,parent) navigator screen history document location event link stylesheets applets form images plugins embeds anchor all textarea text radio button reset select selection [elements] option password checkbox submit style 12
  • 13. Sites: Ø JavaScript § http://developer.netscape.com/docs/manuals/javascript.html § http://www.gatescript.com/ § http://www.devguru.com/Technologies/ecmascript/quickref/javascript_intro.html § http://webdeveloper.earthweb.com/webjs/ § http://www.jsworld.com/ Ø Dynamic HTML § http://www.dynamicdrive.com/ § http://www.htmlguru.com/guru.html § http://www.w3schools.com/dhtml/ 13