select下拉框显示图片

select下拉框显示图片
2011-11-22

今天,在网易博客中看到一篇好的技术文档,在此记录下来。

将所有供选图片命名为“0.gif”、“1.gif”……“9.gif”,并放在“head”目录下。

图片下拉菜单的代码如下:


请选择图片:




完成后效果如下:
对照上面的代码,我的程序中多了一句:var init=0;,去掉就好了.
var imgWidth=64; //The images width in the imgBox;
var imgHeight=64; //The images height in the imgBox;
var selectedNo=6; //The image's No which is eslected;
var selecteSize=2; //the count of items which be show in the list;
var imgSrc="../images/liuyan/数字序号.gif"; //Don't Replace "数字序号" to figure;
var isnum="数字序号";
var init=0;
/************* Write images *************/
var myHTML='';
myHTML+='cellpadding="0">
+'" WIDTH='+(imgWidth)+' HEIGHT='+imgHeight+'>src="../images/liuyan/menu.gif">
';
myHTML+='
myHTML+='style="position:absolute;left=-800;top=0;background-color:#FFFFFF;border: 1px solid
#000000;overflow-x:hidden;overflow-y:scroll; width:'+(imgWidth+20)+'px; height:
'+imgHeight*selecteSize+'px">';
for(i=1;i<39;i++){

你可能感兴趣的:(技术点滴)