tailieunhanh - HTML cơ bản - p 12

94 Chapter 2: The HTML Language Example : HTML code for image scaling Example Wide Style Figure : A scaled-up image Imagemaps are an extension to the concept of document linking. An imagemap is an ordinary image upon which a set of subareas have been defined, each of which is a hyperlink to a different URL. An image becomes imagemapped when the usemap attribute is added to the image element with a value that matches the name or id attribute value of a map element placed elsewhere in the document. The map element contains a set. | 94 Chapter 2 The HTML Language Example HTML code for image scaling DOCTYPE html html head title Example title head body h1 Wide Style h1 img src height 32 width 100 alt body html Figure A scaled-up image Imagemaps are an extension to the concept of document linking. An imagemap is an ordinary image upon which a set of subareas have been defined each of which is a hyperlink to a different URL. An image becomes imagemapped when the usemap attribute is added to the image element with a value that matches the name or id attribute value of a map element placed elsewhere in the document. The map element contains a set of area elements as it immediate children as in the following snippet of HTML code that could define a button bar From the Library of Wow eBook Audio and Video 95 img src images alt usemap bbar map name bbar area shape rect href coords 0 0 49 29 area shape rect href coords 50 0 99 29 area shape rect href coords 100 0 149 29 map In this HTML three rectangular shapes are defined upon the image at the locations specified in the coords attributes which take values specifying the top-left and bottom-right corners of the hyperlinked area. The first area linked to begins at the top-left corner of the image and extends to a point 49 pixels from the image s left edge and 29 pixels below the top edge of the image. The remaining two area elements define similar areas to the right of the first. Imagemapped areas can overlap. In this case the URL associated with the first area element that matches the coordinates of the reader s mouse click is the one taken. To provide a default URL for clicks on the image that are outside any defined areas a final area element with coordinates encompassing the entire image area can be added. The href attribute is optional but an oncl ick event handler can be used to alert the user. For example area shape rect coords 0 0 200 29 onclick- alertfYou missed Audio .

crossorigin="anonymous">
Đã 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.