wfcvn 发表于 2007-4-27 11:17:14

***页面背景***用按钮来调整各颜色的比例,从而调整背景颜色

把下列代码加到网页的<body></body>标签之间 从google下载我的照片管理软件
要完成此效果把如下代码加入到<body>区域中

<script language="javascript">

<!-- hiding



var red=0;

var green=0;

var blue=0;

var value=0;

var convert = new array()

var hexbase= new array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f");



for (x=0; x<16; x++){

for (y=0; y<16; y++){

convert= hexbase + hexbase;

value++;

}

}



function clear(){

document.color.bl.value= blue;

document.color.rd.value= red;

document.color.gr.value= green;

}



function display(){

redx = convert

greenx = convert

bluex = convert

var rgb = "#"+redx+greenx+bluex;

document.color.rgbdspl.value= rgb;

document.bgcolor =rgb;

}



function upred(x){

if ((red+x)<=255)

red+=x

document.color.rd.value= red;

display()

}



function downred(x){

if ((red-x)>=0)

red-=x

document.color.rd.value= red;

display()

}



function upgreen(x){

if ((green+x)<=255)

green+=x

document.color.gr.value= green;

display()

}



function downgreen(x){

if ((green-x)>=0)

green-=x

document.color.gr.value= green;

display()

}



function upblue(x){

if ((blue+x)<=255)

blue+=x

document.color.bl.value= blue;

display()

}



function downblue(x){

if ((blue-x)>=0)

blue-=x

document.color.bl.value= blue;

display()

}



// done hiding -->

</script>

<form name="color">

                  
<table align="center">
    <tr align="center">

                        
      <td width="52">
      <input name="red" type="button" value=" +50 " onclick="upred(50)">

                        </td>

                        
      <td width="58">
      <input name="red2" type="button" value=" + 10 " onclick="upred(10)">

                        </td>

                        
      <td width="46">
      <input name="red2" type="button" value=" + 1" onclick="upred(1)">

                        </td>

                        
      <td width="52"><font color="#ff0000" size=+3><b><font color="#fa0000" face="楷体_gb2312">红</font></b></font></td>
      <td width="46">
      <input name="red-" type="button" value=" - 1" onclick="downred(1)">

                        </td>

                        
      <td width="58">
      <input name="red-" type="button" value=" - 10 " onclick="downred(10)">

                        </td>

                        
      <td width="52">
      <input name="red-" type="button" value=" -50 " onclick="downred(50)">

                        </td>

                        
      <td width="29">
      <input type="text" name="rd" size=3>

                        </td>

                      </tr>

                      <tr align="center">

                        
      <td width="52">
      <input name="green" type="button" value=" +50 " onclick="upgreen(50)">

                        </td>

                        
      <td width="58">
      <input name="green" type="button" value=" + 10 " onclick="upgreen(10)">

                        </td>

                        
      <td width="46">
      <input name="green" type="button" value=" + 1" onclick="upgreen(1)">

                        </td>

                        
      <td width="52"><font color="#00ff00" size=+3><b><font color="#00fa00" face="楷体_gb2312">绿</font></b></font></td>
      <td width="46">
      <input name="green-" type="button" value=" - 1" onclick="downgreen(1)">

                        </td>

                        
      <td width="58">
      <input name="green-" type="button" value=" - 10 " onclick="downgreen(10)">


                        </td>

                        
      <td width="52">
      <input name="green-" type="button" value=" -50 " onclick="downgreen(50)">

                        </td>

                        
      <td width="29">
      <input type="text" name="gr" size=3>

                        </td>

                      </tr>

                      <tr align="center">

                        
      <td width="52">
      <input name="blue" type="button" value=" +50 " onclick="upblue(50)">

                        </td>

                        
      <td width="58">
      <input name="blue" type="button" value=" + 10 " onclick="upblue(10)">

                        </td>

                        
      <td width="46">
      <input name="blue" type="button" value=" + 1" onclick="upblue(1)">

                        </td>

                        
      <td width="52"><font color="#0000ff" size=+3><b><font color="#0000fa" face="楷体_gb2312">蓝</font></b></font></td>
      <td width="46">
      <input name="blue-" type="button" value=" - 1" onclick="downblue(1)">

                        </td>

                        
      <td width="58">
      <input name="blue-" type="button" value=" - 10 " onclick="downblue(10)">

                        </td>

                        
      <td width="52">
      <input name="blue-" type="button" value=" -50 " onclick="downblue(50)">

                        </td>

                        
      <td width="29">
      <input type="text" name="bl" size=3>

                        </td>

                      </tr>

                      <tr align="center">

                        
      <td width="52"> </td>

                        
      <td width="58"> </td>

                        
      <td width="46"> </td>

                        
      <td width="52">
      <input type="text" name="rgbdspl" size=7>

                        </td>

                        
      <td width="46"> </td>

                        
      <td width="58"> </td>

                        
      <td width="52"> </td>

                        
      <td width="29"> </td>

                      </tr>

                  </table>

                  
<div align="center"></div>
<div align="center"></div>
</form>
      










--------------------------------------

http://www.huoyue.com.cn 活跃网,活跃人群的论坛,访问活跃网,将给您带来意想不到的收获,还可以免费为您开论坛,让您免费拥有与朋友、网友交流的论坛。你是年轻人吗?你活跃你就上!
页: [1]
查看完整版本: ***页面背景***用按钮来调整各颜色的比例,从而调整背景颜色