上拉下拉按鈕的背景圖片不顯示
?<script type="text/javascript">
$(function() {
//定義變量
var intR = 0,
intG = 0,
intB = 0,
strColor;
// $("#input").each(function(index) {
// $(this).spinner({
$("input").spinner({
//初始化插件
max: 10,
min: 0,
//設置微調按鈕遞增/遞減事件
spin: function(event, ui) {
if(ui.value == 8)
spnPrev.style.backgroundColor = "red";
else
spnPrev.style.backgroundColor = "green";
//setSpanColor(index, ui.value);
},
//設置微調按鈕值改變事件
change: function(event, ui) {
var intTmp = $(this).spinner("value");
if(intTmp < 0) $(this).spinner("value", 0);
if(intTmp > 10) $(this).spinner("value", 10);
if(intTmp == 8)
spnPrev.style.backgroundColor = "red";
else
spnPrev.style.backgroundColor = "green";
//setSpanColor(index, $(this).spinner("value"));
}
});
});
</script>
2017-03-24
按鈕的html代碼是“<span id="spnPrev" class="prev fr"></span>”通過js進行加載