JavaScript FOR ™ DUMmIES phần 6

Đồ họa nghiêng? GoGraph tự do cung cấp các biểu tượng tải về và đồ họa ởTạo hai chức năng JavaScript, gắn liền với xử lý sự kiện onMouseOver và gắn liền với xử lý sự kiện onmouseout. Sau đây là hai ví dụ sử dụng chức năng trao đổi tùy chỉnh () | Chapter 8 Creating Interactive Images 171 Not graphically inclined GoGraph offers freely downloadable icons and graphics at . 2. Create two JavaScript functions one attached to the onMouseOver event handler and one attached to the onMouseOut event handlers. The following are two examples that use the custom swap function to swap the image named mkt_pic from the white version to the purple version . A HREF . Example 1 Swapping from white to purple on mouseOver onMouseOver swap mkt_pic Example 2 Swapping from purple to white on mouseOut onMouseOut swap mkt_pic displayMsg return true IMG NAME mkt_pic SRC WIDTH 72 HEIGHT 12 BORDER 0 A You can find a working version of the code responsible for Figures 8-8 and 8-9 which includes the swap function as well as the following JavaScript code on the companion CD in the file . 3. Add an optional but recommended JavaScript function that preloads all of the images. Preloading images helps ensure that when users mouse over images for the first time they don t have to wait while additional images download from the Web server one at a time. I show you how these three steps work together in the following section where you see how to construct a typical navigation bar with rollover effects step by step. Creating navigation bars by putting rollovers together Navigation bars such as the one shown previously in Figures 8-8 and 8-9 are wonderful tools for helping your users find their way around your Web site. Fortunately because navigation bars are nothing more than a collection of rollovers combined with links to different Web pages they re also pretty easy to put together as you see in the following sections. The approach to navigation bar creation that I demonstrate in this chapter is the old-fashioned code-by-hand approach. Point-and-click visual tools such as Macromedia Dreamweaver make the process of creating navigation bars even more .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
198    76    1    10-05-2024
89    82    3    10-05-2024
8    77    1    10-05-2024
Đã 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.