怎么制作XP风格的滚动条??在线等待,谢谢!!!

赠100分
---------------------------------------------------------------

1<script src="scroll.js"></script>

放在

1<head>~~</head>

之间

scroll.js:
document.onselectstart=new Function("return false;")
document.ondragstart=new Function("return false;")
var upm;
var downm;
var leftm;
var rightm;
st=0;
function bu(){
if(event.button==4)
alert("Not support.")
}
function langth(){
a=window.document.body.clientHeight/main.scrollHeight;
b=(window.document.body.clientHeight-scru.style.pixelHeight-scrd.style.pixelHeight)a;
c=window.document.body.clientWidth/main.scrollWidth;
d=(window.document.body.clientWidth-scrlH.style.pixelWidth-scrrH.style.pixelWidth)c;
if (a>=1){
scrb.style.display="none";
main.style.pixelTop=0
fk.style.display="none";
main1.style.pixelWidth=window.document.body.clientWidth;
}
else {
scrb.style.display="block";
}
if(c>=1){
scrbH.style.display="none";
main.style.pixelLeft=0
fk.style.display="none";
main1.style.pixelHeight=window.document.body.clientHeight;
}
else{
scrbH.style.display="block";
}
if(a<1&&c>=1){
scrb.style.pixelHeight=window.document.body.clientHeight;
scr.style.pixelHeight=b;
a1=(scrb.style.pixelHeight-scru.style.pixelHeight-scrd.style.pixelHeight)/main.scrollHeight;
scr.style.pixelTop=scru.style.pixelHeight-main.style.pixelTop
a1;
main1.style.pixelWidth=window.document.body.clientWidth-scrb.style.pixelWidth;
if (scr.style.pixelTop>window.document.body.clientHeight-scrd.style.pixelHeight-scr.style.pixelHeight){
scr.style.pixelTop=window.document.body.clientHeight-scrd.style.pixelHeight-scr.style.pixelHeight;
main.style.pixelTop=-main.scrollHeight+window.document.body.clientHeight;
}
}
if(a>=1&&c<1){
scrbH.style.pixelWidth=window.document.body.clientWidth;
scrH.style.pixelWidth=d;
c1=(scrbH.style.pixelWidth-scrlH.style.pixelWidth-scrrH.style.pixelWidth)/main.scrollWidth;
scrH.style.pixelLeft=scrlH.style.pixelWidth-main.style.pixelLeft
c1;
main1.style.pixelHeight=window.document.body.clientHeight-scrbH.style.pixelHeight-1;
if (scrH.style.pixelLeft>scrbH.style.pixelWidth-scrrH.style.pixelWidth-scrH.style.pixelWidth){
scrH.style.pixelLeft=scrbH.style.pixelWidth-scrrH.style.pixelWidth-scrH.style.pixelWidth;
main.style.pixelLeft=-main.scrollWidth+window.document.body.clientWidth;
}
}
if(a<1&&c<1){
scrb.style.pixelHeight=window.document.body.clientHeight-scrrH.style.pixelHeight;
a=scrb.style.pixelHeight/main.scrollHeight;
b=(scrb.style.pixelHeight-scru.style.pixelHeight-scrd.style.pixelHeight)a;
scr.style.pixelHeight=b;
a1=(scrb.style.pixelHeight-scru.style.pixelHeight-scrd.style.pixelHeight)/main.scrollHeight;
scr.style.pixelTop=scru.style.pixelHeight-main.style.pixelTop
a1;
main1.style.pixelWidth=window.document.body.clientWidth-scrb.style.pixelWidth;
scrbH.style.pixelWidth=main1.style.pixelWidth;
c=scrbH.style.pixelWidth/main.scrollWidth;
d=(scrbH.style.pixelWidth-scrlH.style.pixelWidth-scrrH.style.pixelWidth)c;
scrH.style.pixelWidth=d;
c1=(scrbH.style.pixelWidth-scrlH.style.pixelWidth-scrrH.style.pixelWidth)/main.scrollWidth;
scrH.style.pixelLeft=scrlH.style.pixelWidth-main.style.pixelLeft
c1;
main1.style.pixelHeight=window.document.body.clientHeight-scrbH.style.pixelHeight-1;
fk.style.display="block";
if (scrH.style.pixelLeft>scrbH.style.pixelWidth-scrrH.style.pixelWidth-scrH.style.pixelWidth){
scrH.style.pixelLeft=scrbH.style.pixelWidth-scrrH.style.pixelWidth-scrH.style.pixelWidth;
main.style.pixelLeft=-main.scrollWidth+scrbH.style.pixelWidth
}
if (scr.style.pixelTop>scrb.style.pixelHeight-scrd.style.pixelHeight-scr.style.pixelHeight){
scr.style.pixelTop=scrb.style.pixelHeight-scrd.style.pixelHeight-scr.style.pixelHeight;
main.style.pixelTop=-main.scrollHeight+scrb.style.pixelHeight;
}
}
}
function find(){
y=event.clientY-scr.style.pixelTop;
st=1}
function findH(){
x=event.clientX-scrH.style.pixelLeft;
st=2}
function scrollit(){
if (st==1){
y1=event.clientY-y;
if (y1<=scru.style.pixelHeight){
scr.style.pixelTop=scru.style.pixelHeight;
main.style.pixelTop=0;
}
else if (y1>=scrb.style.pixelHeight-scrd.style.pixelHeight-scr.style.pixelHeight){
scr.style.pixelTop=scrb.style.pixelHeight-scrd.style.pixelHeight-scr.style.pixelHeight;
main.style.pixelTop=-main.scrollHeight+scrb.style.pixelHeight;
}
else{
scr.style.pixelTop=y1;
bb=y1/a;
main.style.pixelTop=-bb;
}
}
if (st==2){
x1=event.clientX-x;
if (x1<=scrlH.style.pixelWidth){
scrH.style.pixelLeft=scrlH.style.pixelWidth;
main.style.pixelLeft=0;
}
else if (x1>=scrbH.style.pixelWidth-scrrH.style.pixelWidth-scrH.style.pixelWidth){
scrH.style.pixelLeft=scrbH.style.pixelWidth-scrrH.style.pixelWidth-scrH.style.pixelWidth;
main.style.pixelLeft=-main.scrollWidth+scrbH.style.pixelWidth;
}
else{
scrH.style.pixelLeft=x1;
dd=(scrH.style.pixelLeft-scrlH.style.pixelWidth)/c1;
main.style.pixelLeft=-dd;
}
}
}
function upmain(){
if(scr.style.pixelTop>scru.style.pixelHeight&&main.style.pixelTop<0){
main.style.pixelTop+=(4/a1);
scr.style.pixelTop-=4;
}
else{
main.style.pixelTop=0;
scr.style.pixelTop=scru.style.pixelHeight;
}
}
function downmain(){
lan=scrb.style.pixelHeight-scrd.style.pixelHeight-scr.style.pixelHeight;
lan1=-main.scrollHeight+scrb.style.pixelHeight;
if(scr.style.pixelTop

 1<lan&&main.style.pixeltop>lan1){   
 2main.style.pixelTop-=(4/a1);   
 3scr.style.pixelTop+=4;   
 4}   
 5else{   
 6main.style.pixelTop=lan1;   
 7scr.style.pixelTop=lan;   
 8}   
 9}   
10function leftmain(){   
11if(scrH.style.pixelLeft&gt;scrlH.style.pixelWidth&amp;&amp;main.style.pixelLeft&lt;0){   
12main.style.pixelLeft+=(7/c1);   
13scrH.style.pixelLeft-=7;   
14}   
15else{   
16main.style.pixelLeft=0;   
17scrH.style.pixelLeft=scrlH.style.pixelWidth;   
18}   
19}   
20function rightmain(){   
21lanH=scrbH.style.pixelWidth-scrrH.style.pixelWidth-scrH.style.pixelWidth;   
22lan1H=-main.scrollWidth+scrbH.style.pixelWidth;   
23if(scrH.style.pixelLeft<lanh&&main.style.pixelleft>lan1H){   
24main.style.pixelLeft-=(7/c1);   
25scrH.style.pixelLeft+=7;   
26}   
27else{   
28main.style.pixelLeft=lan1H;   
29scrH.style.pixelLeft=lanH;   
30}   
31}   
32function scrollitfa(){   
33p=event.clientY;   
34if(st==0){   
35h=scrb.style.pixelHeight-scrd.style.pixelHeight-scr.style.pixelHeight;   
36go()   
37}   
38}   
39function go(){   
40if(p&gt;scru.style.pixelHeight+10&amp;&amp;p<h-5){ else="" if(p="" main.style.pixeltop="-(p-scru.style.pixelHeight-5)/a1;" scr.style.pixeltop="p-5;" }="">scru.style.pixelHeight+10&amp;&amp;p&gt;h-5&amp;&amp;p<scrb.style.pixelheight-scrd.style.pixelheight){ else="" if(p<scru.style.pixelheight+10&&p="" main.style.pixeltop="-main.scrollHeight+scrb.style.pixelHeight;" scr.style.pixeltop="h;" }="">scru.style.pixelHeight){   
41scr.style.pixelTop=scru.style.pixelHeight;   
42main.style.pixelTop=0;   
43}   
44}   
45function scrollitfaH(){   
46pH=event.clientX;   
47if(st==0){   
48hH=scrbH.style.pixelWidth-scrrH.style.pixelWidth-scrH.style.pixelWidth;   
49goH()   
50}   
51}   
52function goH(){   
53if(pH-scrlH.style.pixelWidth&gt;10&amp;&amp;pH<hh-5){ else="" if(ph-scrlh.style.pixelwidth="" main.style.pixelleft="-(pH-scrlH.style.pixelWidth-5)/c1;" scrh.style.pixelleft="pH-5;" }="">10&amp;&amp;pH&gt;hH-5&amp;&amp;pH<scrbh.style.pixelwidth-scrrh.style.pixelwidth){ else="" if(ph-scrlh.style.pixelwidth<10&&ph-scrlh.style.pixelwidth="" main.style.pixelleft="-main.scrollWidth+scrbH.style.pixelWidth;" scrh.style.pixelleft="hH;" }="">0){   
54scrH.style.pixelLeft=scrlH.style.pixelWidth;   
55main.style.pixelLeft=0;   
56}   
57}   
58\---------------------------------------------------------------   
59  
60body这样写:   
61<body bgcolor="#FFFFFF" onload="langth()" onmousedown="bu()" onmousemove="scrollit()" onmouseup="scr.style.filter='alpha(opacity=100)';scrH.style.filter='alpha(opacity=100)';st=0;clearInterval(upm);clearInterval(downm);clearInterval(leftm);clearInterval(rightm);" onresize="langth()" scroll="no" style="BORDER-RIGHT: 0px; PADDING-RIGHT: 0px; BORDER-TOP: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; BORDER-LEFT: 0px; PADDING-TOP: 0px; BORDER-BOTTOM: 0px">   
62  
63  
64  
65将下面代码放在<body>~</body>里   
66  
67&lt;DIV oncontextmenu="return false" onmousedown=scrollitfa() id=scrb   
68style="BORDER-RIGHT: 0px; PADDING-RIGHT: 0px; BORDER-TOP: 0px; PADDING-LEFT: 0px; RIGHT: 0px; PADDING-BO</body></scrbh.style.pixelwidth-scrrh.style.pixelwidth){></hh-5){></scrb.style.pixelheight-scrd.style.pixelheight){></h-5){></lanh&&main.style.pixelleft></lan&&main.style.pixeltop>
Published At
Categories with Web编程
Tagged with
comments powered by Disqus