1. Trang chủ
  2. » Giáo án - Bài giảng

Document Object Model (DOM)

30 289 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Document Object Model (DOM)
Trường học CSEHui University
Chuyên ngành Computer Science & Engineering
Thể loại essay
Năm xuất bản 2023
Thành phố Unknown
Định dạng
Số trang 30
Dung lượng 531,35 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

HTML DOM The Document Object Model is a platform- and language-neutral interface that will allow programs and scripts to dynamically access and update the content, structure and style

Trang 1

Document Object Model (DOM)

Trang 2

HTML DOM

The Document Object Model is a platform- and

language-neutral interface that will allow programs and scripts to dynamically access and update the content, structure and style of

Trang 3

CREATING OBJECTS

Define the function:

function ObjectName(List Parameter)

{

this.property1= Parameter1;

this.property2= Parameter2;

… this.method1=functionName1;

this.method2=functionName2;

Trang 5

ARRAY OBJECT

Array: An array is a special variable, which can

hold more than one value, at a time

An array can be defined in three ways:

 var myCars=new Array();

Trang 6

ARRAY OBJECT

Array Object Properties

Ex:

var fruits = ["Banana", "Orange", "Apple", "Mango"];

document.write("Original length: " + fruits.length);

Trang 7

ARRAY OBJECT

Array Object Methods

Trang 8

DATE OBJECT

Date Object: The Date object is used to work

with dates and times

 Date objects are created with new Date()

 There are four ways of instantiating a date:

var d = new Date();

var d = new Date(milliseconds);

var d = new Date(dateString);

var d = new Date(year, month, day, hours,

minutes, seconds, milliseconds);

Trang 9

DATE OBJECT

Date Object Methods

Trang 10

DATE OBJECT

Date Object Methods

Trang 11

MATH OBJECT

The Math object allows you to perform mathematical tasks

Math is not a constructor All properties/methods

of Math can be called by using Math as an object, without creating it

var x = Math.PI; // Returns PI

var y = Math.sqrt(16); // Returns the square root

of 16

Trang 12

MATH OBJECT

Math Object Methods

Trang 13

STRING OBJECT

String:

 The String object is used to manipulate a

stored piece of text

 String objects are created with new String()

Syntax

var txt = new String(string);

Trang 14

MATH OBJECT

String Object Methods

Trang 15

FORM OBJECT

Form:

 The Form object represents an HTML form

 For each instance of a <form> tag in an HTML document, a Form object is created

Form Object Methods

Trang 16

FORM OBJECT

Form Object Properties

Trang 17

FORM OBJECT

Form elements Collection

 The elements collection returns an array containing each element in the form

Syntax

 formObject.elements[].property.

Trang 18

FORM OBJECT

EX:

<form id="myForm">

Firstname: <input id="fname" type="text" value="Mickey" />

Lastname: <input id="lname" type="text" value="Mouse" />

<input id="sub" type="button" value="Submit" />

Trang 20

FORM OBJECT

Button Object Properties

Trang 21

FORM OBJECT

Button Object Methods

Trang 22

FORM OBJECT

Select Object

 The Select object represents a dropdown list

in an HTML form

 For each instance of an HTML <select> tag in

a form, a Select object is created

 You can access a Select object by searching through the elements[] array of the form, or

by using document.getElementById()

Trang 23

FORM OBJECT

Select Object Properties

Trang 24

FORM OBJECT

Select Object Methods

Trang 25

 You can access a radio object by searching through the elements[] array of the form, or

by using document.getElementById()

Trang 26

FORM OBJECT

Radio Object Properties

Trang 27

FORM OBJECT

Radio Object Methods

Trang 29

FORM OBJECT

Text Object Properties

Trang 30

FORM OBJECT

Text Object Methods

Ngày đăng: 13/05/2014, 19:51

TỪ KHÓA LIÊN QUAN

w