I added a specialPreview listTwo list display modes
It was written in-10 months. For details, enter the source.Foot home
Copy codeThe 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. js
Copy 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