1. Trang chủ
  2. » Công Nghệ Thông Tin

Học JavaScript qua ví dụ part 73 pptx

1 281 0
Tài liệu đã được kiểm tra trùng lặp

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

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 1
Dung lượng 140,17 KB

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

Nội dung

15.7 Modifying the DOM Appending, Copying, and Removing Nodes 653 If you want to dynamically remove a post from a blog or an ingredient from an online recipe, it can be done with the DO

Trang 1

15.7 Modifying the DOM (Appending, Copying, and Removing Nodes) 653

If you want to dynamically remove a post from a blog or an ingredient from an online

recipe, it can be done with the DOM To delete an element or node from the DOM tree,

we use the removeChild() method This method must be called from the parent node

because you will be removing a child It takes a reference to the child it will remove as

its only argument The following examples demonstrate how to dynamically remove

nodes with JavaScript and the DOM The first example, Example 15.15, removes a div

and its contents; the second example, Example 15.16, removes paragraphs

4 A reference to a new div is returned.

5 The cloned table is appended to the div just below the original table (see Figure 15.26)

6 This is the div container for the cloned table.

Figure 15.26 Cloning a table with a unique id.

E X P L A N A T I O N (C O N T I N U E D)

From the Library of WoweBook.Com

Ngày đăng: 04/07/2014, 02:20