TAILIEUCHUNG - Học JavaScript qua ví dụ part 10

Hộp thoại Tương tác với người dùng các Chương trình như để nói chuyện, đặt câu hỏi, nhận được câu trả lời, và trả lời. Trong chương trước, chúng ta đã thấy cách viết () và writeln () phương pháp được sử dụng để gửi đầu ra của tài liệu để trình duyệt. Tài liệu này được định nghĩa trong một đối tượng và ghi () và writeln () là phương pháp để thao tác các tài liệu, làm cho nó làm điều gì đó. Các đối tượng tài liệu được định nghĩa trong cửa sổ. Các cửa sổ cũng là một. | chapter 4 Dialog Boxes Interacting with the User Programs like to talk ask questions get answers and respond. In the previous chapter we saw how the write and writeln methods are used to send the document s output to the browser. The document is defined in an object and write and writeln are methods that manipulate the document make it do something. The document object is defined within a window. The window is also an object and has its own methods. The window object uses dialog boxes to interact with the user. The dialog boxes are created with three methods alert prompt confirm The alert Method The window s alert method is used to send a warning to the user or alert him or her to do something. For example you might let the user know he or she has not entered his or her e-mail address correctly when filling out a form or that his or her browser doesn t support a certain plug-in and so on. The alert box is also commonly used for debugging to find out the results of a calculation if the program is executing in an expected order and so on. The alert method creates a little independent window called a dialog box that contains a a user-customized message placed after a small triangle and beneath it an OK button. See Figure . When the dialog box pops up all execution is stopped until the user clicks the OK button in the pop-up box. The exact appearance of this dialog box might differ slightly on different browsers but its functionality is the same. Unlike the write method the alert method doesn t require the window object name in front of it as . Because the window is the top-level browser object it doesn t have to be specified. This is true with any window object methods you use. 73 From the Library of 74 Chapter 4 Dialog Boxes The message for the alert dialog box is any valid expression variable or a string of text enclosed in matching quotes and sent as a single argument to the alert method. HTML tags are not rendered within the

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.