ࡱ> gifE@ (bjbj (B vvvv%%%%,.%42n%(%%%%'''1111111$2R#5j1t('"'t(t(1vv%%;1---t(v8%%1-t(1-:-4.01%b% HS%*0>1\1020,5,651vvvv51<'(-( !(S'''11D-Javascript Scripting languages such as Javascript and VBScript are used to add functionality to web pages. They can be either included in the web page itself or stored in a separate file. In the latter case, the web page must include a link to the file. Scripts are downloaded with the web page, unlike Java applets and servlets. Applets are not downloaded until the browser reaches the tag. Servlets always execute on the server, not the users computer. But Javascript is downloaded immediately and is executed on the clients computer, thus saving time that would otherwise be used for repeated connections to the server. Javascript is not Java, but it shares some syntax with Java and C. It is not strongly typed, so variables do not have to be declared, although they may be. Also statements do not require a terminating semi-colon, but again these may be included. If two statements are on the same line, they must be separated by a semi-colon. Also like Java, Javascript is case sensitive. Script That Says Hello The following example simply writes the word "Hello" into the box when the user clicks the button. It does not send anything to the server, so the form includes neither an action nor a method attribute. Javascript Hello Example
Scripts may be placed either in the head or body of the page. It is somewhat more common to put them into the head, since it is downloaded first. Also this separates the script from the rest of the page. If the script is external, the head would be as follows: Javascript Hello Example The script file, helloScript.js, would contain only the following code: Note that the script is placed inside a comment. This causes older browsers that do not support Javascript to skip the lines. Javascript Functions Functions in Javascript are very simple. They may either perform an action, such as the one above, or return a value. A useful example of the latter is found in the next example. It checks a login form to see that all the boxes have been filled in. This check is performed by the users browser rather than on the server. This saves a significant amount of time when the form contains a number of boxes. This example shows an alert message and returns false, if the box is empty. The alert message is contained in a popup box as shown below. A false value prevents the action from taking place. However, if both boxes contain text, the value true is returned and the request is sent to the server. Login Form

Please Login

Username:
Password:
/body>  SHAPE \* MERGEFORMAT  Functions can also have parameters. These are not typed, but otherwise they are similar to those in Java methods. An example would be if there were two forms on the same page and the function had to distinguish between them. The function heading might look like function CheckForm (formName) and the submit tag . Objects in Javascript Javascript also has objects. The one in the next example is a Date object. Like in Java, it must be instantiated before it can be used. There are a number of accessor methods included with this object that get parts of the date, such as the year, month, day, hours, minutes and seconds. The values are those that are stored in the users computer. If the computer time is accurate, the results of the function will be also. The document mentioned in the script is the web page. This will write the date and time on the web page. As with any html page you have to use tags such as
or

to indicate a line or paragraph break. Numerical Data and Arrays Text boxes contain text, i.e. strings, and not numbers. If the contents of a box are to represent numbers, they must first be parsed before they can be used in a calculation. As in Java, the method to use is parseInt. If the text box, weightBox, contains an integer, the following can be used to change the contents from a string to a number: weight = parseInt (weightBox.value); After a calculation, the answer may turn out to be a double with a number of decimal places. The following will round these to two decimal places: mean = Math.round ((sum / count)* 100) / 100; Occasionally a box may be empty or an answer may not exist. Then Javascript displays NAN. This stands for Not a Number. Checking a box for empty before using it is prudent. Javascript has arrays, and like those in Java they begin with index 0. They are instantiated with new. var arrayName = new Array (); They do not have a fixed length, so the number of objects in the array can be found using arrayName.length; Arrays can also be filled initially using parentheses: var prices = new Array (2.89, 1.50, 1.00, 4.95, 3.50); The contents of an array are accessed the same as in Java using square brackets. prices [0] = 3.75; Creating New Windows Javascript can also create a new window with a specified HTML document in it. This document can either be on your local disk or on the Internet. The following example creates a new window for a date-time page. The code is straightforward. You have to tell the browser where to find the HTML page and how large the window should be. The following shows a sample script that opens a new window. The first attribute tells where to find the page to open. The second says that it should be opened in a window. The last two give the width and height of the new window (in pixels). Notice that the width and height are enclosed by a single set of double quotation marks since they combine to make up a single attribute. The new window created with this script appears below. It is a functioning window and can be used like any other HTML page.  References Susan Anderson-Freed, Weaving a Website, Prentice-Hall, 2001. The w3schools web site,  HYPERLINK "http://www.w3schools.com/" http://www.w3schools.com/.       B S ( ) , Q [ \ | }     !)*13MP³³¤¤³³³’³³’³³³³³³³¤hhhzCJaJ#hzhz5B*CJ\aJphhhhzB*CJaJphhzhzB*CJaJphhzB*CJaJphhzCJOJQJh`ghzCJaJhzCJaJhz hzhzCJOJQJ^JaJ1      { 2[ce>?gdzgdz$a$gdz((:Rcv4567=>*+01NPYZ\qշլhalhzCJaJhzhzCJOJQJhoWhzCJaJh&khzCJaJhzB*CJaJph#hzhz5B*CJ\aJphh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rN /G9!jPC9J#5!S y6] 4>+ՙ.O3-ƕrW/3S Ix \+6!.te֎I2/pl*|tcckߛk!Zo-8Pn ZΙ:D8ӱ)\Z%-BG8ϥ4q.,"*k9_QoҼPJSڱlOY/4b3!˩< otX˹ "8^y.a)|뱖svD;ŽaQ`+㜵J|6ReJ,\_NItN6w9nR&0bHO$*Ϩv9|PSPXpP^msEs69mQ"9EP\6@"`(rNBTrN0F9 !*PD `P@l?>Qj#B7I$IENDB`@@@ zNormalCJ_HaJmH sH tH Z@Z z Heading 1$<@&5CJ KH OJQJ\^JaJ \@\ z Heading 2$<@& 56CJOJQJ\]^JaJV@V z Heading 3$<@&5CJOJQJ\^JaJDA@D Default Paragraph FontRiR  Table Normal4 l4a (k(No List6U@6 z Hyperlink >*B*ph  B {2[ce> ? n o  ( - V \ $)1=Ybj] 7Jhi3Kc:;8g{|fghiklmxy      00000000(00000000000000000000(00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (000000000000000000(00000000000000000000(00|0|0|0|0|0|0|0|0|0|0|0|0|0|0|00m 0m 0m000My0 0Y">0 {2[ce> ? n o  ( - V \ $)1=Ybj] 7Jhi3Kc:;8g{|fghiklmxy   00000000(00000000000000000000(00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (000000000000000000(00000000000000000000(00|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0x0m 0m 0mM900O900i'(Yg#(( (   _X8@(  X w L 3  s"*?`  c $X99?w LT  # w e B S  ?  Ppt><U X 9*urn:schemas-microsoft-com:office:smarttagsplace AJ%v   *  $ 5 M WY"+-5luw~:FS_drIXgv{jl&(7'   }4:   1 3 a f @Fdh!7:`h47LP?Fhn   33333333333333333333333333333333333}3[?  + 1 Z a '?Zcld;8h|     Carol E Wolf Carol Wolf [eҟh ^`hH.h ^`hH.h pLp^p`LhH.h @ @ ^@ `hH.h ^`hH.h L^`LhH.h ^`hH.h ^`hH.h PLP^P`LhH. [e          ?(r:>0D8Ga* d:ezM? Jl *9&0@`D  `@UnknownGz Times New Roman5Symbol3& z Arial"qh.f.fM:M:!24  3QH)?r:> Javascript Carol E Wolf Carol Wolf Oh+'0x  4 @ LX`hp Javascriptava Carol E WolfoaroaroNormal  Carol Wolff2roMicrosoft Word 10.0@F#@S@SM՜.+,D՜.+,D hp  Pace University:   Javascript Title 8@ _PID_HLINKSAlBUhttp://www.w3schools.com/  !#$%&'()*+,-./0123456789:<=>?@ABCDEFGHIJKLMNOPQRSTUWXYZ[\]_`abcdehRoot Entry FdSjData "t01Table;5WordDocument(BSummaryInformation(VDocumentSummaryInformation8^CompObjj  FMicrosoft Word Document MSWordDocWord.Document.89q