Static pages can also be original in different display modes of the preview list.

Source: Internet
Author: User

I added a special Preview list Two list display modes
It was written in-10 months. For details, enter the source. Foot home CopyCode The Code is as follows: // used for list display
Function changeshow (Num ){
VaR thenum = num, thestyle;
If (num = 1 ){
Thestyle = "NONE ";
Setcookie ("num", "1", 6)
VaR elements1 = Document. getelementsbytagname ("Div ");
For (VAR I = 0; I <elements1.length; I ++ ){
If (elements1 [I]. ID = 'dxy '){
Elements1 [I]. classname = 'info2 ';
}
}
} Else
{
Thestyle = ""
Setcookie ("num", "0", 6)
VaR elements2 = Document. getelementsbytagname ("Div ");
For (VAR I = 0; I <elements2.length; I ++ ){
If (elements2 [I]. ID = 'dxy '){
Elements2 [I]. classname = 'info ';
}
}
}
VaR elements = Document. getelementsbytagname ("Div ");
For (VAR I = 0; I <elements. length; I ++ ){
If (elements [I]. ID = 'jb51 '){
If (elements [I]. style. display! = Thestyle ){
Elements [I]. style. Display = thestyle;
}
}
}
}

Function setcookie (name, value) // set Js for cookies
{
VaR argv = setcookie. arguments;
VaR argc = setcookie. Arguments. length;
VaR expires = (argc> 2 )? Argv [2]: NULL;
If (expires! = NULL)
{
VaR largeexpdate = new date ();
Largeexpdate. settime (largeexpdate. gettime () + (expires * 1000*3600*24 ));
}
Document. Cookie = Name + "=" + escape (value) + (expires = NULL )? "": ("; Expires =" + largeexpdate. togmtstring ()));
}

Function getcookie (name) // cookies read JS
{
VaR search = Name + "="
If (document. Cookie. length> 0)
{
Offset = Document. Cookie. indexof (Search)
If (offset! =-1)
{
Offset + = search. Length
End = Document. Cookie. indexof (";", offset)
If (END =-1) End = Document. Cookie. Length
Return Unescape (document. Cookie. substring (offset, end ))
}
Else return ""
}
}

PS:
1. You must include the <Div id = jb51> In the generated static file. Of course, you can change the note at will.
In the above CodeVaR elements = Document. getelementsbytagname ("Div ");
Code
2. Call method:Copy codeThe Code is as follows: <SCRIPT type = text/JavaScript Language = JavaScript src = "list. js"> </SCRIPT>

3. Add poplist. jsCopy codeThe Code is as follows: Try {
VaR dxynum = getcookie ("num ");
Changeshow (dxynum );
}
Catch (e ){

}

specific application: http://www.jb51.net/html/list/list_1_1.htm

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.