Template:Template ZJU-China 2010
From 2010.igem.org
(Difference between revisions)
Fatestudio (Talk | contribs) |
Fatestudio (Talk | contribs) |
||
Line 438: | Line 438: | ||
function switchbackground(){ | function switchbackground(){ | ||
- | + | function change(){ | |
- | + | var lipan = Math.random(); //产生0-1之间的随机数 | |
- | + | lipan = lipan * 6; //用随机数乘以10 | |
- | + | lipan = Math.round(lipan); //取整 | |
- | + | var lipath = ""; | |
- | + | switch(lipan){ | |
- | + | case 0: lipath = "https://static.igem.org/mediawiki/2010/4/45/Zjuheader1.jpg";break; //图片位置 | |
- | + | case 1: lipath = "https://static.igem.org/mediawiki/2010/1/12/Zjuheader2.jpg";break; | |
- | + | case 2: lipath = "https://static.igem.org/mediawiki/2010/b/b7/Zjuheader3.jpg";break; | |
- | + | case 3: lipath = "https://static.igem.org/mediawiki/2010/0/0e/Zjuheader4.jpg";break; | |
- | + | case 4: lipath = "https://static.igem.org/mediawiki/2010/d/d1/Zjuheader5.jpg";break; | |
- | + | case 5: lipath = "https://static.igem.org/mediawiki/2010/c/cd/Zjuheader6.jpg";break; | |
- | + | case 6: lipath = "https://static.igem.org/mediawiki/2010/9/97/Zjuheader7.jpg";break; | |
- | + | } | |
- | + | document.getElementById("header").style.backgroundImage = "URL("+lipath+")"; //显示对应的图片 | |
- | + | } | |
- | + | setInterval("change()",1000); //每1秒钟掉用一次change() | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
} | } | ||
Revision as of 20:14, 27 October 2010