select默認的太難看了,在這用jquery 插件imageselect.js進行美化,就圖片進行下拉菜單的選擇
這個網頁特效代碼如下:
<!DOCTYPE html> <head> <title>支持圖片選擇的jQuery列表框插件imageselect.js</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script type="text/javascript" src="jquery.min.1.7.1.js" ></script> <script type="text/javascript" src="imageselect.js"></script> <style> .jqis{position: relative;} .jqis_header{background-image: url('dropdown_arrow.png'); background-position: right center;background-repeat: no-repeat;cursor: pointer;} .jqis_header img{cursor: pointer;} .jqis_dropdown{padding: 5px;position: absolute;overflow-x: hidden;overflow-y: scroll;} .jqis_dropdown img{margin-right: 3px;cursor: pointer;float: left;} </style> </head> <body> <p>請在下拉列表中選擇:</p> <select name="logo"> <option value="1">wall_s5.jpg</option> <option value="2">wall_s8.jpg</option> <option value="3">wall_s7.jpg</option> <option value="4">wall_s6.jpg</option> </select> <script type="text/javascript"> $(document).ready(function(){ $('select[name=logo]').ImageSelect({dropdownWidth:425}); }); </script> </body> </html>