TAILIEUCHUNG - JavaScript Bible, Gold Edition part 157

JavaScript Bible, Gold Edition part 157. 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. | 1408 Part V Putting JavaScript to Work true return false When a user drops the currently selected map object the release function invokes the onTarget function to find out if the current location of the map is within range of the desired destination. If it is in range the background color of the state label object is set to green and the done property of the selected state s database entry is set to true. One additional test the isDone function call looks to see if all the done properties are true in the database. If so the congrats object is shown. But if the object is not in the right place the label reverts to its original red color. In case the user moves a state that was previously okay its database entry is also adjusted. No matter what the outcome however the user has dropped the map so key global variables are set to null and the layer order for the item is set to zero bottom of the heap so that it doesn t interfere with the next selected map. One more condition is possible in the release function. As shown later in the initialization function the document object s onmousemove event handler is assigned to the release function to compare the onmousemove events for the state maps go to dragIt . The reasoning behind this document-level event assignment is that no matter how streamlined the dragging function may be it is possible for the user to move the mouse so fast that the map can t keep up. At that point mousemove events are firing at the document or other object eventually bubbling up to the document and not the state map. If that happens while a state map is registered as the selected object but the image is no longer the target of the event the code performs the same act as if the user had released the map. The label reverts to red and all relevant globals are set to null preventing any further interaction with the map until the user mouses down again on the map. onmouseup see if dragged map is near its destination coordinates if so .

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.