Javascript not working on liquid css button
I am redesigning a web application . I want to introduce color themes in it. When i click on a particular theme i want a new look to appear including buttons. For this i m using the below css code which uses only 3 button images(single image sliced in 3)wherin only the background color is to be changed thru css and new button gets created.
body {
margin: 0;
padding: 10px;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 14px;
}
.btn {
float: left;
clear: both;
background: url(images/btn_left.png) no-repeat;
padding: 0 0 0 10px;
margin: 5px 0;
}
.btn a{
float: left;
height: 40px;
background: url(images/btn_stretch.png) repeat-x left top;
line-height: 40px;
padding: 0 10px;
color: #fff;
font-size: 1em;
text-decoration: none;
}
.btn span {
background: url(images/btn_right.png) no-repeat;
float: left;
width: 10px;
height: 40px;
}
.btn_addtocart { background-color: green; }
HTML code:
<div class="btn btn_addtocart"><a href="#>Submit</a><span></span></div>
<div class="clear"></div>
Background Color: Red
For eg in a login screen
The earlier web application used:
<input type="image" onclick="javascript:return validate()>
wherin the validate function includes
function validate()
{
var user = document.login.loginid.value;
var pwd = document.login.loginid.value;
if(document.login.loginid.value.length==0)
{
alert("Enter user name");
return false;
}
if(document.login.password.value.length==0)
{
alert("Enter password");
document.login.password.focus();
return false;
}
return true;
}
I cannot use javascript:return validate() with this new html code
i.e.
<div class="btn btn_addtocart">
<a href="#>Submit</a><span></span></div>
<div class="clear"></div>
Background Color: Red
Please provide an alternative javascript to run this css code or alternative css code for this javascript.
{mod edit - inserted code tags}