⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 手动调节背景色.htm

📁 VBSCRIPT的源码,相信很多html程序员都会用到,这些源码小小变动一下,可以用在很多地方,尤其在DHTML中!
💻 HTM
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>

<META content="text/html; charset=gb2312" 
http-equiv=Content-Type><TITLE>手动调节背景色</TITLE>
<STYLE type=text/css>
<!--
	body {  font-family: "宋体"; font-size: 9pt; margin-top: 0px; margin-left: 4px; margin-right: 0px}
	A { COLOR: black; FONT-SIZE: 9pt; FONT-WEIGHT: 400; TEXT-DECORATION: none }
 	A:hover { COLOR: red; FONT-SIZE: 9pt; FONT-WEIGHT: 400; TEXT-DECORATION: underline }
	a:active     { font: 9pt "宋体"; cursor: hand; color: #FF0033 }
-->
</STYLE>
<script LANGUAGE="VBScript">
<!--
'保存三基色数字参数变量
 dim redNum,greepNum,blueNum
 '保存三基色字符参数变量
 dim redstr,greepstr,bluestr
 '保存颜色参数变量
 dim colorStr

  '获得基色的函数
 function getcolorstr( k )
 	dim str
 	if cint(k)>255 then
    	k=255
    end if
    str=trim(cstr(hex(k)))
    if len(str)=1 then
    	str="0"+str
    end if
    getcolorstr=str
 end function
 '-------------------------------------------------------
 '获得红色的正基色参数
 sub upred( i)
    if trim(document.color.rd.value)="" then
		document.color.rd.value="0"
	end if
 	rednum=i+cint(document.color.rd.value)
 	if rednum >255 then
 		rednum=255
 	end if
 	  document.color.rd.value=rednum
 	 call initfunction
 end sub
 '获得红色的负基色参数
 sub downred( i)
    if trim(document.color.rd.value)="" then
		document.color.rd.value="0"
	end if
 	 rednum=cint(document.color.rd.value)-i
 	 if rednum<0 then
 	  	rednum=0
 	 end if	
  	 document.color.rd.value=rednum
 	 call initfunction
 end sub
'------------------------------------------------
  '获得绿色的正基色参数
 sub upgreep( i)
    if trim(document.color.gr.value)="" then
		document.color.gr.value=0
	end if
 	  greepnum=i+cint(document.color.gr.value)
 	  if greepnum >255 then
 		greepnum=255
 	end if
 	  document.color.gr.value=greepnum
 	 call initfunction
 end sub
 '获得绿色的负基色参数
 sub downgreep( i)
    	if trim(document.color.gr.value)="" then
		document.color.gr.value="0"
	end if
 	 greepnum=cint(document.color.gr.value)-i
 	 if greepnum<0 then
 	  	greepnum=0
 	 end if
 	 document.color.gr.value=greepnum
 	 call initfunction
 end sub
 '-----------------------------------------------
  '获得蓝色的正基色参数
 sub upblue (i)
    if trim(document.color.bl.value)="" then
		document.color.bl.value="0"
	end if
 	bluenum=i+cint(document.color.bl.value)
 	if bluenum>255 then
 		bluenum=255
 	end if
 	document.color.bl.value=bluenum
 	 call initfunction
 end sub
 '获得篮色的负基色参数
 sub downblue(i)
    if trim(document.color.bl.value)="" then
		document.color.bl.value="0"
	end if
 	 bluenum=cint(document.color.bl.value)-i
 	 if bluenum<0 then
 	  	bluenum=0
 	 end if
 	 document.color.bl.value=bluenum
 	 call initfunction
 end sub
'初始化背景颜色的函数('当改变基色时都要调用)
sub initfunction
 	redstr=getcolorstr(rednum)
 	greepstr=getcolorstr(greepnum)
 	bluestr=getcolorstr(bluenum)   
	colorstr="#"& redstr & greepstr &bluestr
	'msgbox colorstr
	 call inittext
	document.color.rgbdspl.value=colorstr
	document.bgcolor=colorstr
end sub
sub inittext
	if instr(1,document.color.rd.value,"-")>0 then
	   document.color.rd.value=0
	   redstr="00"
	end if
	if instr(1,document.color.gr.value,"-")>0 then
	   document.color.gr.value=0
	   greepstr="00"
	end if
	if instr(1,document.color.bl.value,"-")>0 then
	   document.color.bl.value=0
	   bluestr="00"
	end if
end sub
-->
</script>
</HEAD>
<body bgcolor="#3C9696">
<center><br>
<h2>手动调节背景颜色</h2>
<br><br>
</center>
 <center>
            <FORM name=color> 
            <TABLE> 
                <TBODY> 
                <TR align=middle> 
                    <TD><INPUT name=red onclick=upred(50) type=button value=" +50 ">  
                        </TD> 
                    <TD><INPUT name=red2 onclick=upred(10) type=button value=" + 10 ">  
                        </TD> 
                    <TD><INPUT name=red2 onclick=upred(1) type=button value=" + 1">  
                        </TD> 
                    <TD width=50><FONT color=#ff0000 size=+3><B><FONT  
                        color=#fa0000>红</FONT></B></FONT></TD> 
                    <TD><INPUT name=red- onclick=downred(1) type=button value=" - 1">  
                        </TD> 
                    <TD><INPUT name=red- onclick=downred(10) type=button value=" - 10 ">  
                        </TD> 
                    <TD><INPUT name=red- onclick=downred(50) type=button value=" -50 ">  
                        </TD> 
                    <TD> 
                        <INPUT name=rd size=3> </TD></TR> 
                <TR align=middle> 
                    <TD><INPUT name=green onclick=upgreep(50) type=button value=" +50 ">  
                        </TD> 
                    <TD><INPUT name=green1 onclick=upgreep(10) type=button value=" + 10 ">  
                        </TD> 
                    <TD><INPUT name=green2 onclick=upgreep(1) type=button value=" + 1">  
                        </TD> 
                    <TD width=50><FONT color=#00ff00 size=+3><B><FONT  
                        color=#00fa00>绿</FONT></B></FONT></TD> 
                    <TD><INPUT name=green- onclick=downgreep(1) type=button value=" - 1">  
                        </TD> 
                    <TD><INPUT name=green- onclick=downgreep(10) type=button value=" - 10 ">  
                        </TD> 
                    <TD><INPUT name=green- onclick=downgreep(50) type=button value=" -50 ">  
                        </TD> 
                    <TD> 
                        <INPUT name=gr size=3> </TD></TR> 
                <TR align=middle> 
                    <TD><INPUT name=blue onclick=upblue(50) type=button value=" +50 ">  
                        </TD> 
                    <TD><INPUT name=blue onclick=upblue(10) type=button value=" + 10 ">  
                        </TD> 
                    <TD><INPUT name=blue onclick=upblue(1) type=button value=" + 1">  
                        </TD> 
                    <TD width=50><FONT color=#0000ff size=+3><B><FONT  
                        color=#0000fa>蓝</FONT></B></FONT></TD> 
                    <TD><INPUT name=blue- onclick=downblue(1) type=button value=" - 1">  
                        </TD> 
                    <TD><INPUT name=blue- onclick=downblue(10) type=button value=" - 10 ">  
                        </TD> 
                    <TD><INPUT name=blue- onclick=downblue(50) type=button value=" -50 ">  
                        </TD> 
                    <TD> 
                        <INPUT name=bl size=3> </TD></TR> 
                <TR align=middle> 
                    <TD>&nbsp;</TD> 
                    <TD>&nbsp;</TD> 
                    <TD>&nbsp;</TD> 
                    <TD width=50> 
                        <INPUT name=rgbdspl size=7> </TD> 
                    <TD>&nbsp;</TD> 
                    <TD>&nbsp;</TD> 
                    <TD>&nbsp;</TD> 
                    <TD>&nbsp;</TD></TR></TBODY>
   </TABLE></FORM><BR><BR> 
   </CENTER>
   </body>
   <BR><BR><BR><BR><BR><BR></HTML> 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -