Đang chuẩn bị liên kết để tải về tài liệu:
JavaScript Bible, Gold Edition part 114

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

JavaScript Bible, Gold Edition part 114. This book will bring programmers and non-technical professionals, including casual programmers and scripters, painlessly up to speed on all aspects of mastering JavaScript. Key topics include programming fundamentals, JavaScript language elements and how to use them effectively, and how to easily and efficiently add powerful new functionality to HTML documents and Java applets. | 978 Part IV JavaScript Core Language Reference Date and time arithmetic You may need to perform some math with dates for any number of reasons. Perhaps you need to calculate a date at some fixed number of days or weeks in the future or figure out the number of days between two dates. When calculations of these types are required remember the lingua franca of JavaScript date values milliseconds. What you may need to do in your date-intensive scripts is establish some variable values representing the number of milliseconds for minutes hours days or weeks and then use those variables in your calculations. Here is an example that establishes some practical variable values building on each other var oneMinute 60 1000 var oneHour oneMinute 60 var oneDay oneHour 24 var oneWeek oneDay 7 With these values established in a script I can use one to calculate the date one week from today var targetDate new Date var dateInMs targetDate.getTime dateInMs oneWeek targetDate.setTime dateInMs Another example uses components of a date object to assist in deciding what kind of greeting message to place in a document based on the local time of the user s PC clock. Listing 36-2 adds to the scripting from Listing 36-1 bringing some quasi-intelligence to the proceedings. Again this script uses the older array creation mechanism to be compatible with Navigator 2 and Internet Explorer 3. Listing 36-2 A Dynamic Welcome Message HTML HEAD TITLE Date String Maker TITLE SCRIPT LANGUAGE JavaScript function MakeArray n this.length n return this monthNames new MakeArray 12 monthNames 1 January monthNames 2 February monthNames 3 March monthNames 4 April monthNames 5 May monthNames 6 June monthNames 7 July monthNames 8 August monthNames 9 September monthNames 10 oCtober monthNames 11 November monthNames 12 December Chapter 36 The Date Object 979 dayNames new MakeArray 7 dayNames 1 Sunday dayNames 2 Monday dayNames 3 Tuesday dayNames 4 Wednesday dayNames 5 Thursday dayNames 6 Friday dayNames 7 Saturday

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.