|
- 1. //@Mr.Think获取对象属性兼容方法
- 2 function $(objectId) {
- 3 if(document.getElementById && document.getElementById(objectId)) {
- 4 return document.getElementById(objectId);// W3C DOM
- 5 } else if (document.all && document.all(objectId)) {
- 6 return document.all(objectId);// MSIE 4 DOM
- 7 } else if (document.layers && document.layers[objectId]) {
- 8 return document.layers[objectId];// NN 4 DOM..this won't find nested layers
- 9 } else {
- 10 return false;
- 11 }
- 12 }
- 13 //@Mr.Think切换显示文字和背景图位置
- 14 function iLeftNav(type) {
- 15 var inum,i_navinfo=$("i_navinfo");
- 16 if(type=="writeblog"){
- 17 inum="-300px";
- 18 }else if(type=="sharepic"){
- 19 inum="-600px";
- 20 }else if(type=="writemsg"){
- 21 inum="-900px";
- 22 }else{
- 23 inum="-300px";
- 24 }
- 25 i_navinfo.innerHTML=$(type).innerHTML;
- 26 i_navinfo.style.backgroundPosition=inum+" 0";
- 27 }
- 28 //@Mr.Think加载鼠标莫过事件
- 29 window.onload=function(){
- 30 var liitem=$("i_blognav").getElementsByTagName("li");
- 31 for(var i=0; i<liitem.length; i++){
- 32 liitem[0].onmouseover=function(){iLeftNav("writeblog")}
- 33 liitem[1].onmouseover=function(){iLeftNav("sharepic")}
- 34 liitem[2].onmouseover=function(){iLeftNav("writemsg")}
- 35 }
- 36 }
复制代码 |
评分
-
查看全部评分
|