TAILIEUCHUNG - THE BOOK OF JAVASCRIPT, 2ND EDITION phần 9

Việc chuyển nhượng Chương 2 yêu cầu bạn thay đổi Hình 2-12 để giây được hiển thị cùng với các phút và giờ. Sử dụng getSeconds các đối tượng ngày () phương pháp để có được số giây và fixTime () chức năng để sửa chữa các định dạng của những giây. | A ANSWERS TO ASSIGNMENTS Here are solutions to the assignments I ve given at the end of each chapter. The scripts and images used in the solutions may be found on this book s companion website http www . . The JavaScript in this appendix contains comments where I think explanation is necessary. If your solution works and is not much longer than mine you ve done a good job. There is no assignment for Chapter 1 so we ll start with Chapter 2. Chapter 2 The Chapter 2 assignment asks you to change Figure 2-12 so that seconds are displayed along with minutes and hours. Use the Date object s getSeconds method to get the number of seconds and the fixTime function to fix the formatting of the seconds. html head title Chapter 2 Assignment title script type text javascript -- hide me from older browsers get the date information var today new Date var the_day var the_month var the_hour var the_minutes var the_seconds correct for the month starting from zero the_month the_month 1 add leading zeros if necessary the_day fixTime the_day the_minutes fixTime the_minutes the_seconds fixTime the_seconds create the string you want to print var the_whole_date the_month the_day var the_whole_time the_hour the_minutes the_seconds This is the time fixer function--don t worry about how this works either. function fixTime number if number 10 number 0 number return number show me -- script head body Right now it s script type text javascript -- hide me from older browsers write the date the_whole_date the_whole_time show me -- script body html 382 Appendix

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.