页面滑块式调色板

<!--样式表部分=============================================================-->
<style type="text/css">
.drag {CURSOR: hand; POSITION: relative;HEIGHT: 17px; LEFT: 2px; WIDTH: 20px; Z-INDEX: 3}
#barLyr,#barLyr1,#barLyr2{BACKGROUND-COLOR: #000; HEIGHT: 110px; LEFT: 9px; POSITION: absolute; TOP: 5px; WIDTH: 2px; Z-INDEX: 1}
#innerLyr,#innerLyr1,#innerLyr2{BACKGROUND-COLOR: #888; HEIGHT: 117px; LEFT: 2px; POSITION: absolute; TOP: 2px; WIDTH: 20px; Z-INDEX: 2}
#outerLyr,#outerLyr1,#outerLyr2{BACKGROUND-COLOR: #000; HEIGHT: 120px; POSITION: absolute; TOP: 80px; WIDTH: 23px; Z-INDEX: 1}
#outerLyr {LEFT:30px;}
#outerLyr1{LEFT:60px;}
#outerLyr2{LEFT:90px;}
</style>
<!--JS部分=============================================================-->
<script type="text/javascript">
var sPosition;
var showPerc=100;
document.onmousedown=dragLayer
document.onmouseup=new Function("dragMe=false")
var Color= new Array();
Color[0] = "00";
Color[1] = "11";
Color[2] = "22";
Color[3] = "33";
Color[4] = "44";
Color[5] = "55";
Color[6] = "66";
Color[7] = "77";
Color[8] = "88";
Color[9] = "99";
Color[10] = "AA";
Color[11] = "BB";
Color[12] = "CC";
Color[13] = "DD";
Color[14] = "EE";
Color[15] = "FF";
var rVal,gVal,bVal, cCol
function chgBg() {
 cCol = document.bgColor; rVal=cCol.substr(1,2); gVal=cCol.substr(3,2); bVal=cCol.substr(5,2);
 ind = Math.round(showPerc/16); if (ind < 0) ind = 0; if (ind > 15) ind=15;
 if (kObj.id =="knobImg") document.bgColor="#"+Color[ind]+gVal+bVal;
 if (kObj.id =="knobImg1")  document.bgColor="#"+rVal+Color[ind]+bVal;
 if (kObj.id =="knobImg2")  document.bgColor="#"+rVal+gVal+Color[ind];
}
var dragMe=false, kObj, yPos,direction
function moveLayer() {
if (event.button==1 && dragMe) {
 oldY = kObj.style.pixelTop; kObj.style.pixelTop=temp2+event.clientY-yPos;
 if (kObj.style.pixelTop > oldY) direction="dn"; else direction="up";
 if (kObj.style.pixelTop < 2 && direction=="up") {kObj.style.pixelTop=2; direction="dn";}
 if (kObj.style.pixelTop > 102 && direction=="dn") {kObj.style.pixelTop=102; direction="up";}
 sPosition=kObj.style.pixelTop; showPerc = (perCent[0].checked) ? sPosition-2 : (sPosition-2)/2*5;
 chgBg();
 return false; }
}
function dragLayer() {
if (!document.all) return;
if (event.srcElement.className=="drag") {dragMe=true; kObj=event.srcElement; temp2=kObj.style.pixelTop; yPos=event.clientY; document.onmousemove=moveLayer; }
}
</script>
<!--页面内容部分=============================================================-->
<h4>页面滑块式调色板</h4>
<p>模式:
  <INPUT name="perCent" type="radio" value="false" />
  Prozent
  <INPUT name="perCent" type="radio" value="true" checked>
  255</p>
<DIV id="outerLyr"><IMG class="drag" id="knobImg" style="TOP: 100px;">
  <DIV id="innerLyr">
    <DIV id="barLyr"></DIV>
  </DIV>
</DIV>
<DIV id="outerLyr1"><IMG class="drag" id="knobImg1" style="TOP: 100px;">
  <DIV id="innerLyr1">
    <DIV id="barLyr1"></DIV>
  </DIV>
</DIV>
<DIV id="outerLyr2"><IMG class="drag" id="knobImg2" style="TOP: 100px;">
  <DIV id="innerLyr2">
    <DIV id="barLyr2"></DIV>
  </DIV>
</DIV> 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值