我需要根据外部的某个值更改正在更改颜色停止参数百分比的渐变。我怎样才能改变它?
例如#ff2828 15%, #fff728 15%
。通过更改这两个值,我可以控制颜色。
这是我的代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"></meta>
<title>beep</title>
<style>
.backgroungDiv{
height:31px;
width:600px;
position:absolute;
background: #ff3232; /* Old browsers */
background: -moz-linear-gradient(left, #ff3232 0%, #ff2828 15%, #fff728 15%, #fff728 54%, #28ff33 81%, #8fff89 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, right top, color-stop(0%,#ff3232), color-stop(15%,#ff2828), color-stop(15%,#fff728), color-stop(54%,#fff728), color-stop(81%,#28ff33), color-stop(100%,#8fff89)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(left, #ff3232 0%,#ff2828 15%,#fff728 15%,#fff728 54%,#28ff33 81%,#8fff89 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(left, #ff3232 0%,#ff2828 15%,#fff728 15%,#fff728 54%,#28ff33 81%,#8fff89 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(left, #ff3232 0%,#ff2828 15%,#fff728 15%,#fff728 54%,#28ff33 81%,#8fff89 100%); /* IE10+ */
background: linear-gradient(to right, #ff3232 0%,#ff2828 15%,#fff728 15%,#fff728 54%,#28ff33 81%,#8fff89 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ff3232', endColorstr='#8fff89',GradientType=1 ); /* IE6-9 */
clip: rect(0px 500px 600px 0px); /* here 2nd argument given on base of SNR calcuation*/
}
</style>
</head>
<script type="text/javascript">
<!--
function SoundOn()
{
if(document.getElementById('chk').checked ==false)
{
document.getElementById('demo').volume=0;
}
else
{
document.getElementById('demo').volume=.3;
document.getElementById('demo').play();
}
}
function SoundOnIe()
{
if(document.getElementById('chk-ie').checked ==false)
{
document.getElementById('demo1').volume="-10000";
}
else
{
document.getElementById('demo1').volume="-3000";
document.getElementById('demo1').play();
}
}
-->
</script>
<body>
<!--[IF IE]>
<BGSOUND id="demo1" loop=-1 volume="-10000" src="beep-9.wav" >
<input id="chk" onClick="SoundOnIe()" type="checkbox">
<![endif]-->
<![IF !IE]>
<audio id="demo" loop=-1 volume=0 src="beep-9.wav" ></audio>
<input id="chk" onClick="SoundOn()" type="checkbox">
<div id="empty" style="background-color:#cccccc;border-width:1px;border-style:solid;border-color:black;height:31px;width:595px;">
<div id="SNR_bar_graph" class="backgroungDiv" style="text-align:center;">16.1</div>
</div>
<![endif]>
</body>
</html>