Download presentation
Presentation is loading. Please wait.
1
JavaScript
2
JavaScript2 math Object n abs –math.abs(-80) is 80 n Many other functions
3
JavaScript3 window Object n The window object represents the browser window –It doesn’t have a name n That is, there is no variable that contains a reference to it –A reference to it is assumed when you use properties such as history or alert( )
4
JavaScript4 window Object n Most browsers allow more than one window open at a time –Thus, implicit window reference refers only to the current window, the window that is displaying the HTML document that contains the JavaScript code currently being executed
5
JavaScript5 window Object n To refer to some other window, you must have a reference to it –Use the open( ) method –This is also a method of a document, so the syntax should be window.open( ) or self.open( )
6
JavaScript6 window Object n The Window object has a property named window and another named self –Both, implicitly, contain references to the window itself window.history window.alert(“Hello there!”)
7
JavaScript7 window Object n The Window object has a property named window and another named self –First argument of open( ) specifies URL of page to displayed, or an empty string to open a blank window var newwin = open("otherpage.html"); newwin.creator = self;
8
JavaScript8 window Object n Every JavaScript expression implicitly refers to the current window –Thus, code like j = 0; is actually the same as window.j = 0; n Variables are nothing more than properties of the current window –Two variables with same name can be declared in different windows or frames without conflicting with each other
9
JavaScript9 window Object n Every JavaScript expression implicitly refers to the current window –JavaScript code running in one window or frame can read and write variables declared by code in another window n Thus, if a top-level window has two frames and the following code in the first frame: parent.frames[1].j = 7; this is equivalent to the following code in the second frame: j = 7;
10
JavaScript10 window Object n Every JavaScript expression implicitly refers to the current window –No really global variables across window and frames
11
JavaScript11 window Object n Every JavaScript expression implicitly refers to the current window –When a page that contains a script is unloaded due to the user pointing the browser to a new page, the script is unloaded along with the page that contains it n What about the script variables? n Since they are properties of the window object, you might think they are still defined
12
JavaScript12 window Object n Every JavaScript expression implicitly refers to the current window –When a page that contains a script is unloaded due to the user pointing the browser to a new page, the script is unloaded along with the page that contains it n If they were, however, this would be dangerous –A new script that was loaded would start off with some baggage
13
JavaScript13 window Object n Every JavaScript expression implicitly refers to the current window –When a page that contains a script is unloaded due to the user pointing the browser to a new page, the script is unloaded along with the page that contains it n All user-defined properties (which includes all variables) are erased whenever a page is unloaded –The lifetime of scripts and of the variables they define is the same as the lifetime of the document object that contains the script
14
JavaScript14 window Object n Garbage collection –JavaScript supports automatic garbage collection –Different techniques in Navigator 2.0, Navigator 3.0, and Navigator 4
15
JavaScript15 window Object n Garbage collection –Navigator 4 / JavaScript 1.2 n Completely transparent
16
JavaScript16 window Object –Navigator 3.0 / JavaScript 1.1 n Uses reference counts n If JavaScript code running in a window object creates an object, o, and a reference to that object is stored in a variable of another window object, then o will continue to exist even after the window object that created it is closed or loads in a different page
17
JavaScript17 window Object n Navigator 3.0 / JavaScript 1.0 –A top-level window may be closed by the user, but the window object associated with it may continue to exist if a variable in another window object contains a reference to the window object that is closed
18
JavaScript18 window Object n Navigator 2.0 –All objects created by JavaScript code running in a particular window object allocate memory from a pool owned by the window object –When the window object is destroyed or when the document object containing the JavaScript program displayed in the window is unloaded, the entire pool of memory is freed at once
19
JavaScript19 window Object n Navigator 2.0 –Disadvantages n If an object is created in one window and a reference to that object is stored in a variable in a second window, that object will be destroyed when the first window moves on to a new page, even though there is an active reference to it –If the other window tries to use this reference, an error will result, possibly resulting in a browser crash
20
JavaScript20 window Object n Navigator 2.0 –Disadvantages n If a window never unloads, its associated memory will never be freed –One frame may serve as a navigation window allowing users to browse a large site in other frames or windows –These other frames or windows may load and unload pages frequently, but the navigation frame remains the same
21
JavaScript21 window Object n Properties –closed n Read-only boolean specifying whether window object is closed –defaultStatus n String specifying default message appearing in status line –document n Reference to document object contained in window object
22
JavaScript22 window Object n Properties –frames[] n An array of frame objects contained by this window object –history n A reference to the history object for this window object –length n The number of elements in the frames[] array; read-only
23
JavaScript23 window Object Properties Properties –location n A reference to the location object for this window object –name n String specifying name of the window object –navigator n A reference to the navigator object that applies to this and all other window objects
24
JavaScript24 window Object n Properties –opener n A reference to the window object that called open() to create this window object –parent n A reference to the parent window (frame) object of the current window object –self n A reference to the window object itself
25
JavaScript25 window Object Properties Properties –status n A string specifying the current contents of the status bar –top n A reference to the top-level window object that contains the current window object –window n A reference to the current window object
26
JavaScript26 window Object n Methods –alert() n Display a simple message in a dialog box window.alert(message) window.alert(message) –Displays message in a dialog box –Dialog box contains an OK button that user can click to dismiss it –User can continue to interact with browser window while the dialog is displayed –JavaScript execution continues while the dialog is displayed –Used to display error messages –message is plain text, so can use newline characters to break your message across multiple lines
27
JavaScript27 window Object n Methods –blur() window.blur() window.blur() n Takes keyboard focus from browser window specified by the window object n If this object is a frame object, then keyboard focus is given to the toplevel window object containing the frame object n The window object will be sent to the background, to the bottom of the window stack
28
JavaScript28 window Object n Methods –clearTimeout() n window.clearTimeout(timeoutId) n Cancels the execution of code that has been deferred with the setTimeout() method n The timeoutId argument is a value returned by the call to setTimeout() and specifies which block of deferred code to cancel
29
JavaScript29 window Object n Methods –close() window.close() window.close() n Closes browser window specified by window n A window object can close itself by issuing self.close() or close() n If window is the only open window object, then it is closed and browser exits n In Navigator 3.0, only window objects opened by JavaScript can be closed by JavaScript
30
JavaScript30 window Object n Methods –confirm() n window.confirm(question) n Displays argument question in a dialog box that pops up over window n Dialog contains OK and Cancel buttons –If user clicks OK, then confirm() returns true –If user clicks Cancel, the confirm() returns false n Blocks all user input to the browser window until user dismisses dialog by clicking on the OK or Cancel buttons
31
JavaScript31 window Object n Methods –confirm() n JavaScript execution pauses until user response n The string question is plain text, so can use newline characters
32
JavaScript32 window Object n Methods –focus() n window.focus() n Gives keyboard focus to browser window specified by window object n If window object is a frame, then keyboard focus is given to top-level window that contains that frame n When window object is given focus, it is brought forward, to top of window stack
33
JavaScript33 window Object n Methods –open() n window.open([url, [name, [features]]]) –url is string specifying url to be displayed in the new window, or the empty string for a blank window –name is a string specifying name for the new window object n This name can be used as value of the target attribute of the (window which displays result of clicking on link), (window which displays result of clicking on image), and tags (window which displays result of form submission)
34
JavaScript34 window Object n Methods –open() n window.open([url, [name, [features]]]) –features is a string specifying features of browser window n If not specified, then new window object will have all standard features
35
JavaScript35 window Object n Methods –open() n Returns a reference to a window object, either newly created or an existing one n If the name argument specifies an existing window object, then a reference to that window object is returned –The returned window object will display the url specified by url, but the features argument will be ignored
36
JavaScript36 window Object n Methods –open() n If the name argument is not specified, or no window object with that name already exists, a new window object is created –The created window object displays the url specified by url and the size and controls specified by features –The name of the new window object is specified by name
37
JavaScript37 window Object n Methods –open() n The features argument is a comma-separated list with the format feature[=value] –For most features, value is yes or no n If feature appears and value is omitted, yes is assumed n If feature doesn't appear, no is assumed –toolbar n Browser toolbar with Back and Forward buttons
38
JavaScript38 window Object n Methods –open() n The features argument is a comma-separated list with the format feature[=value] –location n The input field for entering URL's directly into the browser –directories n Directory buttons, such as "What's New" and "What's Cool" in Netscape –status n The status line
39
JavaScript39 window Object n Methods –open() n The features argument is a comma-separated list with the format feature[=value] –menubar n The menu bar –scrollbars n Enables horizontal and vertical scrollbars when necessary –resizable n window object will have resize handles around its border
40
JavaScript40 window Object n Methods –open() n The features argument is a comma-separated list with the format feature[=value] –width n Width of window object in pixels –height n Height of window object in pixels
41
JavaScript41 window Object n Methods –prompt() n window.prompt(message) window.prompt(message, default) window.prompt(message, default) n Displays specified message in a dialog box that also contains a textual input field and OK, Clear, and Cancel buttons –If user clicks Cancel, prompt() returns null –If user clicks Clear, prompt() erases any text in the input field –If user clicks OK, prompt() returns the current value displayed in the input field (as a string)
42
JavaScript42 window Object n Methods –prompt() n The default argument specifies text that initially appears in the input field n Blocks all user input to the browser window until user dismisses dialog by clicking on the OK or Cancel buttons n JavaScript execution pauses until user response
43
JavaScript43 window Object n Methods –scroll() window.scroll(x,y) window.scroll(x,y) n Moves the window object's document object within the window object, so that the specified x and y coordinates of the document object appear in the upper-left corner of the window object n scroll(0,0) places the top-left of the document object in the top-left corner of the window object
44
JavaScript44 window Object n Methods –setTimeout() n window.setTimeout(code, delay) n Returns a timeout-id that can be passed to the clearTimeout() method to cancel the execution of code n Defers execution of code for delay milliseconds
45
JavaScript45 window Object n Event handlers –onblur() n <body [onBlur = "JavaScript statements"] …> n <frameset [onBlur = "JavaScript statements"] …>
46
JavaScript46 window Object n Event handlers –onblur() n window.onblur = handler_function; –Defining the handler directly n window.onblur(); –An explicit invocation of the handler
47
JavaScript47 window Object n Event handlers –onblur() n Invoked by browser when browser window loses the input focus, either because the user has switched to some other window object, or because focus was explicitly transferred to another browser window with the window object blur() or focus() methods
48
JavaScript48 window Object n Methods –onerror() window.onerror = handler_function; window.onerror = handler_function; –Defining the error handler window.onerror(message, url, line) window.onerror(message, url, line) –Invoking the error handler n Customizing error handling n message specifies the error message for the error that occurred
49
JavaScript49 window Object n Methods –onerror() n url specifies the URL of the document object in which the error occurred n line specifies the line number at which the error occurred
50
JavaScript50 window Object n Methods –onfocus() n <body [onFocus = "JavaScript statements"] …> n <frameset [onFocus = "JavaScript statements"] …>
51
JavaScript51 window Object n Methods –onfocus() n window.onfocus = handler_function; –Defining the handler directly n window.onfocus(); –An explicit invocation of the handler
52
JavaScript52 window Object n Methods –onfocus() n Invoked by browser when browser window is given the input focus, either because the user has switched to this window object, or because focus was explicitly transferred to this browser window with the window object focus() method
53
JavaScript53 window Object n Methods –onload() n <body [onLoad = "JavaScript statements"] statements"]…> n <frameset [rows = "row sizes"] [cols = "column sizes"] [onLoad = "JavaScript statements"]>
54
JavaScript54 window Object n Methods –onload() n window.onload –Reference to handler window.onload() window.onload() –Explicit invocation of handler n Can use this handler to set a variable and to check the value of this variable before doing anything that depends on the complete document object being loaded
55
JavaScript55 window Object n Methods –onunload() n <body [onUnload = "JavaScript statements"] statements"]…> n <frameset [rows = "row sizes"] [cols = "column sizes"] [onUnload = "JavaScript statements"]>
56
JavaScript56 window Object n Methods –onunload() window.onunload window.onunload –Reference to handler window.onunload() window.onunload() –Explicit invocation of handler n Can use this handler to set a variable and to check the value of this variable before doing anything that depends on the complete document object being loaded
57
JavaScript57 document Object n Notation –window.document –document
58
JavaScript58 document Object n Properties –alinkColor n Specifies color of activated links –anchors[ ] n Array of anchor objects, one for each hypertext target n document.anchors[j] or document.anchor-name –anchors.length n Number of elements in anchors[ ]; read-only
59
JavaScript59 document Object n Properties –applets[ ] n An array of Java objects, one for each -tag –applets.length n Number of elements in applets[ ]; –bgColor n A string specifying the background color –cookie n A string that specifies the value of a cookie
60
JavaScript60 document Object n Properties –domain n A string that specifies the domain of the document object –embeds[ ] n An array of Java objects, one for each -tag –embeds.length n Number of elements in embeds[ ]; read-only
61
JavaScript61 document Object n Properties –fgColor n A string specifying the color of document text –forms[ ] n An array of forms objects, one for each -tag n document.forms[j] or document.form_name –forms.length n Number of elements in forms[ ]; read-only
62
JavaScript62 document Object n Properties –images[ ] n An array of image objects, one for each image embedded in the document using the - tag n document.images[i] or document.image_name –images.length n Number of elements in images[ ]; read-only –lastModified n Read-only string that specifies date of most recent document change
63
JavaScript63 document Object n Properties –linkColor n A string specifying color unvisited links –links[ ] n An array of link objects, one for each hypertext link –links.length n Number of elements in links[ ]; read-only
64
JavaScript64 document Object n Properties –location n A synonym for the URL property –plugins[ ] n A synonym for the embeds array –plugins.length n A synonym for embeds.length
65
JavaScript65 document Object n Properties –referrer n A read-only string specifying the URL of the document object that contained the link that referred to the current document –title n A read-only string specifying the of the document object
66
JavaScript66 document Object n Properties –URL n A read-only string specifying the URL of the document object –vlinkColor n A string specifying the color of visited links
67
JavaScript67 document Object n Methods –clear( ) n Erases contents of document object –close( ) n Closes a document stream opened with open() method –open( ) n Opens a stream to which document object contents can be written
68
JavaScript68 document Object n Methods –write( ) n Inserts the specified string into the document object currently being parsed, or into a document stream opened with open( ) –writeln( ) n Same as write but appends a newline character
69
JavaScript69 document Object n Event handlers –onload n Invoked when document is loaded n Specified by onLoad attribute –onunload n Invoked when document is unloaded n Specified by onUnload attribute
70
JavaScript70 document Object n HTML syntax –<body [background = “imageURL”]a background image [bgcolor = “color”]a background color [text = “color”]color of document’s text [link = “color”]color for unvisited links [alink = “color”]color for activated links [vlink = “color”]color for visited links [onLoad = “handler”]onload event handler [onUnload = “handler”]onunload event handler >
71
JavaScript71 form Object n Notation –document.form_name –document.forms[form_number] –document.forms.length
72
JavaScript72 form Object n Properties –action n A string specifying the URL to which the form object is to be submitted –elements[ ] n An array of input elements that appear in the form object n Each element is a button, checkbox, hidden, password, radio, reset, select, submit, text, or textarea object
73
JavaScript73 form Object n Properties –elements.length n Number of items in elements[ ] –encoding n String specifying the encoding method for form data –method n String specifying technique for submitting form –target n String specifying name of frame of window in which results of submitting form should be displayed
74
JavaScript74 form Object n Methods –reset( ) n Reset each of the input elements of the form to their default values –submit( ) n Submit the form
75
JavaScript75 form Object n Event handlers –onreset( ) n Invoked just before elements of form are reset n Specified by onReset attribute –onsubmit( ) n Invoked just before form is submitted n Specified by onSubmit attribute
76
JavaScript76 form Object n HTML syntax –<form [name = “form_name”]name of the form in JavaScript JavaScript [target = “window_name”] name of response window [action = “url”]submitted-to URL [method = (get | post)] method of form submission submission [enctype = “encoding”]how form data is encoded [onSubmit = “handler”]onsubmit( ) event handler [onReset = “handler”]onreset( ) event handler >
77
JavaScript77 button Object n Notation –form.button_name –form.elements[j] –form.elements[‘button_name’]
78
JavaScript78 button Object n Properties –form n Read-only reference to form object that contains button object –name n Read-only string specifying name of the button object –type n Read-only string specifying type of form element n In this case, it is button
79
JavaScript79 button Object n Properties –value n Read-only string specifying value displayed in the button object
80
JavaScript80 button Object n Event handlers –onclick( ) n Invoked when button is clicked
81
JavaScript81 button Object n HTML syntax –<input type = buttonspecifies that this is a button value = “label”text to appear within button [name = “name”]name to refer to button [onClick = “handler”]onclick( ) event handler >
82
JavaScript82 checkbox Object n Notation –Single checkbox n form.checkbox_name n form.elements[j] n form.elements[‘checkbox_name’]
83
JavaScript83 checkbox Object n Notation –Group of checkboxes with same name n form.checkbox_name[j] n form.checkbox_name.length n form.elements[j][k] n form.elements[j].length n form.elements[‘checkbox_name’][j] n formlelements[‘checkbox_name’].length
84
JavaScript84 checkbox Object n Properties –checked n Boolean value specifying whether checkbox object is checked or not –defaultChecked n Boolean value specifying the initial state of checkbox object; read-only –form n Read-only reference to form object containing checkbox object
85
JavaScript85 checkbox Object n Properties –name n Read-only string specifying name of checkbox object –type n Read-only string specifying type of form element n In this case, it is checkbox –value n String specifying value returned by checkbox object if it is selected when form is submitted
86
JavaScript86 checkbox Object n Event handlers –onclick( ) n Invoked when the checkbox is clicked
87
JavaScript87 checkbox Object n HTML syntax –<input type = checkboxspecifies that this is checkbox [name = “name”]name to refer to checkbox [value = “value”]value returned when selected [checked]checkbox is initially checked [onClick = “handler”]onclick( ) event handler >
88
JavaScript88 hidden Object n Notation –form.name –form.elements[j] –form.elements[‘name’]
89
JavaScript89 hidden Object n Properties –form n Read-only reference to containing form object –name n Read-only string specifying name of hidden object –type n Read-only string specifying type of this form element n In this case, it is hidden
90
JavaScript90 hidden Object n Properties –value n String specifying data to be transmitted to server when form is submitted
91
JavaScript91 hidden Object n HTML syntax –<input type = “hidden”specifies that this is hidden object [name = “name”]name to refer to hidden object [value = “value”]value transmitted when form submitted submitted>
92
JavaScript92 password Object n Notation –form.name –form.elements[j] –form.elements[‘name’]
93
JavaScript93 password Object n Properties –form n Read-only reference to form object containing password object –name n Read-only string specifying name of password object –type n Read-only string specifying type of form element n In this case, it is password
94
JavaScript94 password Object n Properties –value n Read-only string specifying password value entered by user
95
JavaScript95 password Object n Methods –blur( ) n Removes keyboard focus from password object –focus( ) n Sets keyboard focus to password object n When focus is set, all keystrokes are automatically entered into this object
96
JavaScript96 password Object n HTML syntax –<input type = “password”specifies this is password object [name = “name”]name to refer to password object [value = “default”]default value transmitted when form is submitted form is submitted [size = integer]number of characters wide of the object object>
97
JavaScript97 radio Object n Notation –Always used in groups of mutually exclusive options that have same name –form.radio_name –form.radio_name.length –form.elements[j][k] –form.elements[j].length –form.elements[‘radio_name’][k] –form.elements[‘radio_name’].length
98
JavaScript98 radio Object n Properties –checked n Boolean value specifying whether button is checked or not –defaultChecked n Read-only Boolean value specifying initial state of radio object –form n Read-only reference to form object containing radio object
99
JavaScript99 radio Object n Properties –name n Read-only string specifying name of radio object –type n Read-only string specifying type of form element n In this case, it is radio
100
JavaScript100 radio Object n Properties –value n String specifying value returned by radio button if it is selected when form is submitted
101
JavaScript101 radio Object n Event handlers –onclick( ) n Invoked when radio button is clicked
102
JavaScript102 radio Object n HTML syntax –<input type = “radio”specifies this is radio button [name = “name”]name to refer to this button [value = “value”]value returned when button is selected selected [checked]button is initially checked [onClick = “handler”]onclick( ) event handler >
103
JavaScript103 reset Object n Notation –form.name –form.elements[j] –form.elements[‘name’]
104
JavaScript104 reset Object n Properties –form n Read-only reference to form object containing reset object –name n Read-only string specifying name of reset object –type n Read-only string specifying type of form element n In this case, it is reset
105
JavaScript105 reset Object n Properties –value n Read-only string specifying text to appear in button
106
JavaScript106 reset Object n Event handlers –onclick( ) n Invoked when reset button is clicked
107
JavaScript107 reset Object n HTML syntax –<input type = “reset”specifies this is reset button [value = “label”]text to appear in button [name = “name”]name to refer to this button [onClick = “handler”]onclick( ) event handler >
108
JavaScript108 select Object n Notation –form.name –form.elements[j] –form.elements[‘name’]
109
JavaScript109 select Object n Properties –form n Read-only reference to form object containing select object –length n Read-only integer specifying number of elements in the options[ ] array –name n Read-only string specifying name of select object
110
JavaScript110 select Object n Properties –options n An array of option objects, each of which describes one of the options displayed within the select object –selectedIndex n A read-only integer specifying the index of the selected option within the select object n If the select object allows multiple selections, then this property only specifies the index of the first selected item or -1 if none are selected
111
JavaScript111 select Object n Properties –type n Read-only string specifying type of form element n In this case, it is either select-one or select- multiple
112
JavaScript112 select Object n Event handlers –onchange( ) n Invoked when the user selects or deselects an item –onblur( ) n Invoked when a user action causes the select object to lose the keyboard focus –onfocus( ) n Invoked when a user action causes the select object to gain the keyboard focus
113
JavaScript113 select Object n HTML syntax –<select name = “name”name identifying the object object [size = integer]number of visible options in object in object [multiple]multiple options may be selected [onChange = “handler”]onchange( ) event handler handler [onBlur = “handler”]onblur( ) event handler [onFocus = “handler”]onfocus( ) event handler >
114
JavaScript114 options Object n Notation –select.options[j]
115
JavaScript115 options Object n Properties –defaultSelected n Read-only boolean value specifying whether this option object is selected by default –index n Read-only integer specifying index of this option object within the array of options –selected n Boolean value specifying whether this option object is currently selected
116
JavaScript116 options Object n Properties –text n Text that describes the option object –value n Specifies value to be passed to server if this option object is selected when form is submitted
117
JavaScript117 options Object n Constructor –new Option([text, [value, [defaultSelected, selected]]]]) [defaultSelected, selected]]]])
118
JavaScript118 options Object n HTML syntax –<option [value = “value”]value returned when form submitted submitted [selected]whether option is initially selected selected>
119
JavaScript119 submit Object n Notation –form.name –form.elements[j] –form.elements[‘name’]
120
JavaScript120 submit Object n Properties –form n Read-only reference to form object containing submit object –name n Read-only string specifying name of submit object –type n Read-only string specifying type of form element n In this case, it is submit
121
JavaScript121 submit Object n Properties –value n Read-only string specifying text to appear in button
122
JavaScript122 submit Object n Event handlers –onclick( ) n Invoked when submit button is clicked
123
JavaScript123 submit Object n HTML syntax –<input type = “submit”specifies this is submit button [value = “label”]text to appear in button [name = “name”]name to refer to this button [onClick = “handler”]onClick event handler >
124
JavaScript124 text Object n Notation –form.name –form.elements[j] –form.elements[‘name’]
125
JavaScript125 text Object n Properties –defaultValue n Read-only string specifying initial value to appear in input field –name n Read-only string specifying name of text object –type n Read-only string specifying type of form element n In this case, it is text
126
JavaScript126 text Object n Properties –value n String specifying value contained in input field
127
JavaScript127 text Object n Methods –blur( ) n Remove keyboard focus from text object –focus( ) n Set keyboard focus to text object n When focus is set, all keystrokes are automatically entered into this object –select( ) n Highlight all text in text object n All future input will replace this highlighted text
128
JavaScript128 text Object n Event handlers –onblur( ) n Invoked when a user action causes the text object to lose keyboard focus –onchange( ) n Invoked when the user changes the value in the text object and move the keyboard focus elsewhere –onfocus( ) n Invoked when a user action causes the text object to gain the keyboard focus
129
JavaScript129 text Object n HTML syntax –<input type = textspecifies that this is a text object [name = “name”]used to refer to this text object [value = “default”]default value transmitted when form is submitted form is submitted [size = integer]number of characters in text object [maxlength = integer]maximum allowed number of input characters characters [onBlur = “handler”]onblur( ) event hander [onChange = “handler”]onchange( ) event handler [onFocus = “handler”]onfocus( ) event handler >
130
JavaScript130 textarea Object n Notation –form.name –form.elements[j] –form.elements[‘name’]
131
JavaScript131 textarea Object n Properties –defaultValue n Read-only string specifying initial value to appear in input field –name n Read-only string specifying name of textarea object –type n Read-only string specifying type of form element n In this case, it is textarea
132
JavaScript132 textarea Object n Properties –value n String specifying value contained in the textarea object
133
JavaScript133 textarea Object n Methods –blur( ) n Remove keyboard focus from textarea object –focus( ) n Set keyboard focus to textarea object n When focus is set, all keystrokes are automatically entered into this object
134
JavaScript134 textarea Object n Event handlers –onblur( ) n Invoked when a user action causes the textarea object to lose keyboard focus –onchange( ) n Invoked when the user changes the value in the textarea object and move the keyboard focus elsewhere –onfocus( ) n Invoked when a user action causes the textarea object to gain the keyboard focus
135
JavaScript135 textarea Object n HTML syntax –<textarea [name = “name”]name of object [rows = integer]number of lines of object [rows = integer]number of lines of object [columns = integer]character width of object [wrap = off|virtual|physical]word wrapping [onBlur = “handler”]onblur( ) event handler [onChange = “handler”]onchange( ) event handler handler [onFocus = “handler”]onfocus( ) event handler >
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.