Willard said:
I need a javascript that will show something like a thermometer where
the thermometer fluid can be periodically set to a certain level.
Using images can be good to provide some background appearance, and you
can then use javascript to have the thermometer level adjusted, changing
height of simple HTML div elements.
<style type="text/css">
div#container{
position:absolute;bottom:10%;right:10%;
width:20px;height:200px;
background:#c00;
border:ridge 1px #000;
overflow:hidden;
}
div#container div{
background:#eee;
line-height:0;
height:100%;
}
</style>
<script type="text/javascript">
onload=function(evt){
this["thermometer"]=function(){
var $th=null;
function getm(dir){
var
ptr_c=document.getElementById("container"),
ptr_t=ptr_c.getElementsByTagName("div")[0];
dir*=-1;
return function(m){
m=ptr_t.offsetHeight+dir*m;
if(0<m&&m<ptr_c.offsetHeight)
ptr_t.style.height=m+"px";
}
}
if(document.getElementById&&
document.getElementsByTagName){
$th={
up:getm(+1),
down:getm(-1)
};
}
return $th;
}();
if(this["thermometer"]){
setTimeout(
function(){
this["thermometer"]
[Math.random()<0.6?"up":"down"](Math.random()*5|0);
setTimeout(arguments.callee,40);
},
50
);
}
}
</script>
<div id="container"><div> </div></div>