<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<style type="text/css">
#bg{background: url(7689827.gif) no-repeat; position: relative; width: 676px; height: 23px;}
#slidebar{position: relative; left: 28px; top: 4px; width: 10px; cursor: pointer}
</style>
</head>
<body>
<div id="bg">
<div id="slidebar"><img onselectstart="return false" unselectable="on" align="absmiddle" src="7689824.gif" /></div>
</div>
<div id="show">
</div>
<script type="text/javascript">
<!--
var o = document.getElementById("slidebar");
o.onmousedown = function(e){
e = e || window.event;
/*record the screenX and left pos*/
var screenX = e.screenX, s = parseInt(o.style.left)||28;
document.onmousemove = function(e2){
e2 = e2 || window.event;
diffX = e2.screenX - screenX;
var ret = s + diffX ;
/*limit pos*/
if(ret > 638) ret = 638;
if(ret < 28) ret = 28;
o.style.left = ret + "px";
document.getElementById("show").innerHTML = ret;
return false;
}
document.onmouseup = function(){
document.onmousemove = null;
document.onmouseup = null;
}
if(e.preventDefault){
this.style.MozUserSelect = 'none'
e.preventDefault();
}
}
//-->
</script>
</body>
</html>
posted on 2009-01-19 13:26
汪杰 阅读(264)
评论(1) 编辑 收藏 引用 所属分类:
javascript