TAILIEUCHUNG - Practical prototype and scipt.aculo.us part 44

Practical prototype and part 44: The information in this book is distributed on an "as is" basis, without warranty Although every pre-caution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work. | CHAPTER 10 INTRODUCTION TO EFFECTS 253 update the score cell with the player s point total from the JSON .update dom loaded function var teamltotaler new Totaler team_1 team_1_total selector tbody .score var team2totaler new Totaler team_2 team_2_total selector tbody .score score updated function the memo property holds the custom data we attached to the event var json break the JSON in half -- one piece for each table. updateTeam table_1 updateTeam table_2 script In other words recomputing the total needs to be the last thing we do when a score updates. Now we need to emphasize rows when they change. This is the perfect use case for the effect that pulses an element s background color to draw attention to it. For this we ll need to add some logic to our updateTeam function script type text javascript charset utf-8 function updateTeam table json table table a team is divided into several positions var positionStats row for var position in json positionStats json position 254 CHAPTER 10 INTRODUCTION TO EFFECTS match up the JSON property name WR1 RB2 TE etc. with the table row that has the corresponding class name row tr. position var scoreCell oldValue Number update the score cell with the player s point total from the JSON is the new value larger than the old value if oldValue new row dom loaded function var teamltotaler new Totaler team_1 team_1_total selector tbody .score var team2totaler new Totaler team_2 team_2_total selector tbody .score score updated function the memo property holds the custom data we attached to the event var json break the JSON in half -- one piece for each table. updateTeam

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.