Download presentation
Presentation is loading. Please wait.
Published byReynold Tobias Dixon Modified over 8 years ago
1
Chapter 4 Java Script – Part2
2
2 Location object Properties Properties href – whole path will be displayed. ex: window.location.href ( see example 11) protocol – protocol will be returned pathname – display path without protocol search – after ? In location bar what ever the command lines are passed that are displayed. Methods Methods replace() – to replace with new file reload() – to reload a file ex: window.location.replace(“1.html”) ( see example 12)
3
3 Example 11.html JavaScript var loc = window.location.href; document.write("Path=" +loc);
4
4 History object Properties Properties Length – to find the number of files in a history. ex: window.history.length ( see example 13) Current – path of current file Previous – path of previous file Next – path of next file Methods Methods Back() – one file back Forward() – one file forward Go() – move multiple file ex: window.history.go(-2)
5
5 Example - 13.Html Functions JavaScript var numberofvisited = window.history.length; document.write("The number of pages visited in this window is" +numberofvisited+ " pages."+" ");
6
6 Document Object Properties Properties Images, links, anchors, forms, layers, applet, bgcolor, text, background, link, alink,vlink etc ex. Window.document.bgcolor Methods Methods write(), writeln(), open(), close() ex. window.document.open()
7
7 Images Object Images is an array object Images is an array object Properties Properties length, hspace, vspace, height, width, border etc ex. window.document.images.lengthMethods No methods
8
8 Links Object Links is an array object Links is an array object The Link object corresponds to a hypertext link The Link object corresponds to a hypertext link Properties Properties length, href, protocol, pathname, search etc ex. window.document.links.length Methods Methods No methods
9
9 Anchors Object The JavaScript anchor object describes a links destination or target. Anchor is an array object Anchor is an array object Properties Properties name, text etc Methods Methods No methods
10
10 Forms Object Forms is an array object Forms is an array object Properties Properties action - This specifies the URL and CGI script file name the form is to be submitted to. elements - An array of fields and elements in the form. encoding - It specifies the encoding method the form data is encoded in before being submitted to the server. It corresponds to the ENCTYPE attribute of the FORM tag. The default is "application/x-www-form-urlencoded". Other encoding includes text/plain or multipart/form-data. length - The number of fields in the elements array. I.E. the length of the elements array method - This is a read or write string. It has the value "GET" or "POST". name - The form name. Corresponds to the FORM Name attribute. target - The name of the frame or window the form submission response is sent to by the server.
11
11 Forms Object(Cont..) Form Objects Form Objects Button, text, password, file upload, radio, check box, text area, reset, select, submit etc. Form Object Methods Form Object Methods reset(), submit() Events Events onReset, onSubmit
12
12 Text Object Properties Properties Name, value, size, maxlength, readonly etc. Methods Methods focus(), blur(), select() Events Events onFocus, onBlur, onSelect, onChange Password Object same as Text Object
13
13 Button, Submit, Reset Object Properties Properties Name, value etc. Methods Methods focus(), blur() Events Events onFocus, onBlur, onClick, onMouseOver, onMouseOut For checking the validations use an ordinary button and call a function. For checking the validations use an ordinary button and call a function. For submitting the form data use the submit button For submitting the form data use the submit button
14
14 Radio Object Properties Properties Name, value, check, length etc. Methods Methods focus(), blur() Events Events onFocus, onBlur, onClick Checkbox Object same as Radio Object
15
15 Select Object Properties Properties Name, size, multiple, selectedIndex, options, length etc. Methods Methods focus(), blur(), select() Events Events onFocus, onBlur, onClick, onChange
16
16 Textarea Object Properties Properties rows, cols, name, value etc. Methods Methods focus(), blur() Events Events onFocus, onBlur, onSelect ex. window.document.formname.textarea.value
17
17 File Object Properties Properties name, value, size etc. Methods Methods focus(), blur() Events Events onFocus, onBlur ex. window.document.formname.filename.value
18
18 External Objects String, Array, Date, Math, Navigator String Object Properties Properties length etc. Methods Methods concat(), substr(), indexOf(), lastIndexOf(), reverse(), charAt(), split(), blink(), italic(), big(), small(), bold(), fontColor(), fontSize(), toUpperCase(), toLowerCase() etc
19
19 Array Object Properties Properties index, input, length etc. Methods Methods pop(), push(), shift(), unshift(), concat(), chop(), splice() etc
20
20 Date Object Properties Properties No properties. Methods Methods getDate(), getDay(), getMonth(), getYear(), getMinutes(), getSeconds(), getTime() etc
21
21 Math Object Methods Methods sin(), cos(), tan(), round(), floor(), sqrt() etc Navigator Object Properties Properties appName, appVersion, appCodeName etc
22
22 Frames Object Frames is an array object ( ) Frames is an array object (The Array object is used to store multiple values in a single variable) Using the frames we can access a document object, history object, location object. Using the frames we can access a document object, history object, location object. Properties Properties src, name, cols, rows, border, scrolling, document, location, history etc ex. Window.framename.document.formname.text.valueMethods blur(), focus() etc
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.