Click here to Skip to main content
15,891,774 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted
Comments
BillWoodruff 15-Sep-11 4:18am    
What have you tried so far ? Please submit some code. best, Bill
hitech_s 15-Sep-11 4:35am    
y dont you try with backgroung image property

Hope below code will work

JavaScript
function displayResult()
{
if(document.getElementById("b1").style.width=="300px")
{
 document.getElementById("b1").style.background="Red";
}
}


HTML
<input type="button" id="b1" onload="displayResult()" value="Button" />
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900