这是我的jquery进度条我想更改进度条的颜色,其中Acceptedbar
类为绿色,类Declinedbar
为红色
<head runat="server">
<title>Idea Storm</title>
<link href="css/CSS.css" rel="stylesheet" type="text/css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js"
type="text/javascript"></script>
<script src="script/ui.progressbar.js" type="text/javascript"></script>
<style type="text/css">
.AcceptedBar > .ui-progressbar-value {
background:green;
}
.DeclinedBar > .ui-progressbar-value {
background: red;
}
</style>
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/smoothness/jquery-ui.css">
<%-- <link href="App_Themes/HRIS-Theme/jquery.ui.core.css" rel="stylesheet" type="text/css" />
<link href="App_Themes/HRIS-Theme/jquery.ui.theme.css" rel="stylesheet" type="text/css" />--%>
</head>
<script type="text/javascript">
$(function ()
{
$('.Accepted').each(function()
{
var valueFromHiddenField = $('input[type=hidden]', this).val();
$('.Acceptedbar', this).progressbar({ value: valueFromHiddenField});
});
});
$(function ()
{
$('.Declined').each(function() {
// We assume that there is only 1 hidden field under 'pbcontainer'
var valueFromHiddenField = $('input[type=hidden]', this).val();
$('.Declinedbar', this).progressbar({ value: valueFromHiddenField });
});
});
</script>
答案 0 :(得分:6)
您应该使用CSS来设置进度条的样式,details on theming here:
.AcceptedBar > .ui-progressbar-value {
background: green;
}
.DeclinedBar > .ui-progressbar-value {
background: red;
}
您无法使用background-color
作为主题设置background-image
,因此您必须使用background
答案 1 :(得分:3)
像这样使用....
$('.Acceptedbar').css('color','Green');
$('.Declinedbar').css('color','Red');
答案 2 :(得分:0)
您应该更改CSS文件中的样式(即颜色),而不是JavaScript。
答案 3 :(得分:0)
在CSS文件中你可以写,
.Acceptbar{color:Green;}
.Declinebar{color:Red;}