Div + CSS + JS instance of a slide bar

Source: Internet
Author: User

<! 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 = gb2312"/>
<Meta http-equiv = "content-language" content = "ZH-CN"/>
<Title> new document </title>
<Meta name = "generator" content = "editplus"/>
<Meta name = "author" content = ""/>
<Meta name = "keywords" content = ""/>
<Meta name = "Description" content = ""/>
<Style type = "text/CSS">
/* <! [CDATA [*/
* {Width: 100%; margin: 0; padding: 0 ;}
Body {font-family: "", Arial, Helvetica, sans-serif; font-size: 12px; color: #444; text-align: center ;}
Ul {list-style-type: none; margin: 0; padding: 0 ;}
A {color: # 4e4e4e; text-Decoration: none; Vertical-align: middle ;}
A: hover {color: #990000 ;}
A: visited {color: # 4e4e4e ;}

# Login {width: 186px; Height: 100px; Border: 1px solid # d2d2d2; margin: 100px auto ;}
# Login. top {margin-top: 6px; margin-left: 6px; width: 60px; float: Left; Background: URL (http://www.lanrentuku.com/images/uppic/200812291724020.gif) No-repeat-100px 6px; Height: 24px ;}
# Login H2 {font-size: 12px; line-Height: 26px; text-align: Left; text-indent: 21px ;}
# Moveico {margin-top: 8px; Background: URL (http://www.lanrentuku.com/images/uppic/200812291724020.gif) No-repeat 12px-30px; width: 110px; Height: 24px; float: Left ;}
# Moveico Div {position: relative; float: Left; left: 13px; top: 4px; Background: URL (http://www.lanrentuku.com/images/uppic/200812291724020.gif) No-repeat-80px 0; width: 12px; height: 12px ;}

# Login input {Height: 16px; color: #666 ;}
# Login. userchk {width: 16px ;}
# Login. userinput {width: 92px; Border: 1px # cbdca8 solid ;}
# Login. usersub {width: 52px; Height: 18px; Background: URL (http://www.lanrentuku.com/images/uppic/200812291724020.gif) No-Repeat; Border: 0; line-Height: 22px; color: #454545; font-size: 12px ;}
# Login span {margin-left: 8px ;}
# Login ul {width: 160px; margin: 0 auto ;}
# Login Li {clear: Left; Height: 21px; line-Height: 21px; text-align: Left; overflow: hidden ;}
# Login Li. Other {border-top: 2px # e0ecc8 solid; margin-top: 3px; text-indent: 6px ;}
# Login A # loginhelp {position: relative; top:-18px; left: 145px; display: block; width: 12px; Height: 12px; Background: # f7fcfc URL (http://www.lanrentuku.com/images/uppic/200812291724020.gif) no-repeat-60px 0 ;}

/*]> */
</Style>
<SCRIPT type = "text/JavaScript">
<! --

// Moveobj

Function BIND (O, Ev, FN ){
If (document. All) O. attachevent ('on' + eV, FN );
Else O. addeventlistener (EV, FN, false );
}
Function setcookie (name, value, time ){
VaR exp = new date ();
Exp. settime (exp. gettime () + 30x24x60*60*1000 );
Document. Cookie = Name + "=" + escape (value) + "; expires =" + exp. togmtstring ();
}
Function getcookie (name ){
VaR arr, Reg = new Regexp ("(^ |)" + name + "= ([^;] *) (; | $ )");
If (ARR = Document. Cookie. Match (REG) return Unescape (ARR [2]);
Else return NULL;
}

Function move_autosetdef (moveobj ){
VaR logintit = new array ("student", "parent", "teacher", "Administrator ");
VaR bnum = 13, mnum = 22, inum = 4, icolength = 6;
// The start distance of bnum to the left of moveobj, the unit length of mnum, the number of inum units 0-1-2-3, and the icolength icon respectively.

VaR Enum = bnum + mnum * (iNum-1 );
VaR $ d = new function ('str', 'Return document. getelementbyid (STR );');
VaR $ event = new function ('E', 'Return (! E )? Window. Event: E ;');
VaR checknowleft = function (z) {return (z <bnum )? Bnum :( (z> Enum )? Enum :( (Z-bnum) % mnum> 11 )? Z + mnum-(Z-bnum) % mnum: Z-(Z-bnum) % mnum )));}
VaR nowseat = 0, drag _ = false;
VaR move_autoset = function (inum ){
$ D (moveobj). getelementsbytagname ("Div") [0]. style. Left = inum * mnum + bnum + "PX ";
$ D ("login-tit"). innerhtml = logintit [inum];
$ D ("login-type"). value = inum; // Add the parameter value to the login-type of hidden.
}

Nowseat = (getcookie ("nowseat") = NULL )? 0: getcookie ("nowseat ");
Move_autoset (nowseat );
$ D (moveobj). getelementsbytagname ("Div") [0]. onmouseover = function (){
VaR x, y, z;
This. onmousedown = function (e ){
Drag _ = true;
With (this ){
VaR temp0 = style. Left. Replace ("PX", "") * 1, temp1 = offsetleft, temp2 = offsettop;
X = $ event (e). clientx;
Y = $ event (e). clienty;
Z = temp0;
Document. onmousemove = function (e ){
// This. selection. Empty ();
If (! Drag _) return false;
With (this ){
Z = temp0 + $ event (e). clientx-X;
Z = (z <bnum )? Bnum :( (z> Enum )? Enum: Z );
Style. Left = z + "PX ";
}
}
Document. onmouseup = function (e ){
Drag _ = false;
VaR nowleft = checknowleft (z );
Nowseat = (nowleft-bnum)/mnum;
Move_autoset (nowseat );
Setcookie ('nowseat', (nowleft-bnum)/mnum );
}
}
}
}
$ D (moveobj). onmouseover = function (){
This. onmousedown = function (e ){
If (drag _) return false;
With (this ){
VaR icoobj = getelementsbytagname ("Div") [0];
VaR temp0 = icoobj. offsetleft;
VaR x = $ event (e). clientx;
VaR nowleft = checknowleft (bnum + mnum * nowseat + (x-temp0)-icolength );
Document. onmouseup = function (e ){
Nowseat = (nowleft-bnum)/mnum;
Move_autoset (nowseat );
Setcookie ('nowseat', (nowleft-bnum)/mnum );
}
}
}
}
}

BIND (window, "LOAD", new function ('move _ autosetdef ("moveico ")'));

// -->
</SCRIPT>
</Head>

<Body>
<Div id = "login" class = "box">
<Form action = "" method = "Post">
<Div id = "moveico"> <div> </div>
<Div class = "TOP"> <H2 class = "active" id = "login-tit"> </H2> </div>
<Input type = "hidden" id = "login-type" name = "Stype" value = "0"/>
<Ul>
<Li> <input name = "" type = "text" class = "userinput"/> <span> <label for = "isremember"> <input name = "isremember" ID = "isremember" type = "checkbox" value = "" class = "userchk"/> remember </label> </span> </LI>
<Li> <input name = "" type = "password" class = "userinput"/> <span> <input name = "" type = "Submit" value = "Login "Class =" usersub "/> </span> </LI>
<Li class = "other"> <a href = "#3"> forgot password </a> | <a href = "#3"> Registration/pass </a> <a href = "#3" id = "loginhelp"> </a> </LI>
</Ul>
</Form>
</Div>
<Br/>

</Body>
</Html>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.