Heim  >  Artikel  >  Web-Frontend  >  许愿墙中用到的函数_javascript技巧

许愿墙中用到的函数_javascript技巧

WBOY
WBOYOriginal
2016-05-16 19:25:37650Durchsuche
复制代码 代码如下:

<script> <BR>//-- 控制层删除start of script --> <BR>function ssdel(){ <BR>if (event) <BR>{ <BR>lObj = event.srcElement ; <br><br>while (lObj && lObj.tagName != "DIV") lObj = lObj.parentElement ; <BR>} <BR>var id=lObj.id <BR> document.getElementById(id).removeNode(true); <BR> //document.getElementById(id).outerHTML="";// <BR> } <br><br>//-- 控制层删除End of script --> <BR></script>
<script> <BR>//-- 控制层移动start of script --> <BR>var Obj='' <BR>var index=10000;//z-index; <BR>document.onmouseup=MUp <BR>document.onmousemove=MMove <br><br>function MDown(Object){ <BR>Obj=Object.id <BR>document.all(Obj).setCapture() <BR>pX=event.x-document.all(Obj).style.pixelLeft; <BR>pY=event.y-document.all(Obj).style.pixelTop; <BR>} <br><br>function MMove(){ <BR>if(Obj!=''){ <BR> document.all(Obj).style.left=event.x-pX; <BR> document.all(Obj).style.top=event.y-pY; <BR> } <BR>} <br><br>function MUp(){ <BR>if(Obj!=''){ <BR> document.all(Obj).releaseCapture(); <BR> Obj=''; <BR> } <BR>} <br><br>function setTagBPic(i) { <BR> picurl = getBPic(i); <BR> getObj('tagBPic').style.background = " transparent url(\"" + picurl + "\") no-repeat scroll bottom left"; <BR> cf.tagbgpic.value = i; <BR>} <br><br>function setTagBColor(i) { <BR> color = getBColor(i); <BR> getObj('preview').style.background = '' + color; <BR> cf.tagbgcolor.value = i; <BR>} <br><br><BR>function getBPic(i) { <BR> i = (i<1 || i>8)?1:i; <BR> return "images/pic" + parseInt(parseInt(i)+27) +".gif"; <BR>} <BR>//-- 控制层移动end of script --> <BR>//获得焦点; <BR>function getFocus(obj) <BR>{ <BR> if(obj.style.zIndex!=index) <BR> { <BR> index = index + 2; <BR> var idx = index; <BR> obj.style.zIndex=idx; <BR> //obj.nextSibling.style.zIndex=idx-1; <BR> } <BR>}<BR></script>
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn