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