复制代代码如下: 颜色选择器 <br>body{ <br> text-align:center; <br>} <br> <br><!-- <BR>var ColorHex=new Array('00','33','66','99','CC','FF') <BR>var SpColorHex=new Array( 'FF0000','00FF00','0000FF','FFFF00','00FFFF','FF00FF') <BR>var current=null <BR>function initcolor(evt) <BR>{ <BR>var colorTable=' ' <BR>for (i=0;i<2;i ) <BR>{ <BR>for (j=0;j<6;j ) <BR>{ <BR>colorTable=colorTable '<tr 高さ=15>' <BR>colorTable=colorTable '<td width=15 style="background-color:#000000">' <br>if (i==0){ <br>colorTable=colorTable '<td width=15 style="cursor:pointer;background-color:#' ColorHex[j] ColorHex[j] ColorHex[j] ' " onclick="doclick(this.style.backgroundColor)">'} <br>else{ <br>colorTable=colorTable '<td width=15 style="cursor:pointer;background-color:#' SpColorHex[ j] '" onclick="doclick(this.style.backgroundColor)">'} <br>colorTable=colorTable '<td width=15 style="background-color:#000000">' <br>for (k=0;k{ <br>for (l=0;l{ <br>colorTable=colorTable '<td width= 15 style="cursor:pointer;background-color:#' ColorHex[k i*3] ColorHex[l] ColorHex[j] '" onclick="doclick(this.style.backgroundColor)">' <br>} <br>} <br>} <br>} <br>colorTable='<table border="0" cellpacing="0" cellpadding="0" style="border:1px #000000 Solid;ボーダーボトム:なし;ボーダー折りたたみ:折りたたみ;幅:337ピクセル;" bordercolor="000000">' <br> '<tr height=20><tdcolspan=21 bgcolor=#ffffff style="font:12px tahoma;padding-left:2px;">' <br> '<span style="float:left;color:#999999;">搜索吧|為站长提供专业知识搜索</span>' <br> '<span style="float:right;padding-right:3px;cursor:pointer;" onclick="colorclose()">×关闭</span>' <br> '</td></table>' <br> '<table border="1" cellpacing="0" cellpadding="0" style="border-collapse: Collapse" bordercolor="000000" style="cursor:pointer;">' <br> colorTable '</table>'; <br>document.getElementById("colorpane").innerHTML=colorTable; <br>var current_x = document.getElementById("inputcolor").offsetLeft; <br>var current_y = document.getElementById("inputcolor").offsetTop; <br>//alert(current_x "-" current_y) <br>document.getElementById("colorpane").style.left = current_x "px"; <br>document.getElementById("colorpane").style.top = current_y "px"; <br>} <br>function doclick(obj){ <br> alert(obj); <br>} <br>function colorclose(){ <br> document.getElementById("colorpane").style.display = "none"; <br> //alert("ok"); <br>} <br>function coloropen(){ <br> document.getElementById("colorpane").style.display = ""; <br>} <br>window.onload = initcolor; <br>