tailieunhanh - Web design creating cool web sites with html xhtml and css phần 7
Animated GIF hình ảnh có sẵn thông qua nhiều nguồn, đặc biệt là các gói lưu trữ clip, hình ảnh và các trang web liệt kê bên cạnh, nhưng bạn cũng có thể tạo riêng của bạn với một số gói đồ hình ảnh động chia sẻ. | Chapter 11 Activating Your Pages with JavaScript Remember the mathematical expression above Here s how it looks in JavaScript var x y y 3 x y 4 That s the JavaScript equivalent of x y 4. Not too hard is it Where do you put JavaScript Before you delve any further into JavaScript you re probably wondering where this stuff goes on your page. The answer is that JavaScript should always live within a script block as shown here script language javascript var x y y 3 x y 4 script This script block adds two variables within the JavaScript portion of your Web page named x and y. The former has the value of 7 and the latter has a value of 3. You can have more than one script block on your page and later script can reference variables set and functions defined by earlier blocks. Events Most people find that tying JavaScript to specific Web page events quite literally something that happens including onLoad and onUnload among others gives them more than enough flexibility. Table 11-1 shows a list of interesting JavaScript events. Table 11-1 Interesting Scriptable Events in JavaScript Event Name Description onblur Input element loses focus user moves cursor elsewhere onchange Similar to oblur but contents change onclick A mouseclick event occurs ondblclick A double-click occurs onfocus User clicks into or tabs into an input element Continued 238 Creating Cool Web Sites with HTM L XHTM L and CSS Table 11-1 Continued Event Name Description onload The page completes loading in the browser onmousedown The user clicks the mouse button onmouseup The user releases the mouse button onmouseout The cursor moves away from the element onmouseover The cursor moves over the element onmove The window moves onresize The window is resized onselect User selects text in an input or textarea element onunload Opposite of onload user leaves the page The four events most commonly used with JavaScript are onclick onmouseover onmouse-out and onload. I explore how to utilize these four events later in .
đang nạp các trang xem trước