如何根据宽度一次给按钮提供三种颜色 [英] How to give three colors to button at one time according to width
本文介绍了如何根据宽度一次给按钮提供三种颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何一次根据宽度给按钮提供三种颜色
例如:
如果按钮的宽度= 600px高度= 70px
100px至200px =蓝色
201px至400px =绿色
401px to 600px = red
解决方案
试试这个-
http://论坛. asp.net/p/1679593/4413615.aspx/1?Re+Div+left+middle+right+in+css+background+linkbutton [ 函数 displayResult() { 如果(文档 .getElementById(" b1").style.width == 300px") { 文档 .getElementById(" ) .style.background = " ; } }
< 输入 类型 =" id =" 加载 =" value =" / >
How to give three colors to button at one time according to width
for example:
if button width=600px height=70px
100px to 200px= blue
201px to 400px= green
401px to 600px= red
解决方案
Hi,
Try this-
http://forums.asp.net/p/1679593/4413615.aspx/1?Re+Div+left+middle+right+in+css+background+linkbutton[^]
Hope below code will work
function displayResult() { if(document.getElementById("b1").style.width=="300px") { document.getElementById("b1").style.background="Red"; } }
<input type="button" id="b1" onload="displayResult()" value="Button" />
这篇关于如何根据宽度一次给按钮提供三种颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文