In order to facilitate the viewing of the content, I specifically added a
Preview List two list display mode
Written in 2 June-October, reprint please specify the source
cloud Habitat Community
Copy Code code as follows:
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)//cookies set JS
{
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 (offset, end) (document.cookie.substring)
}
else return ""
}
}
Ps:
1, you generate static file to have <div id=jb51> words, of course, you can change the attention of the random
In the preceding code
var elements=document.getelementsbytagname ("div");
Code
2. Calling method:
Copy Code code as follows:
<script type=text/javascript language=javascript src= "List.js" ></script>
3. Attached Poplist.js
Copy Code code as follows:
try{
var dxynum=getcookie ("num");
Changeshow (Dxynum);
}
catch (e) {
}
Specific application: http://www.jb51.net/html/list/list_1_1.htm