#1
|
|||
|
|||
请大大帮我分析一下这段javascript代码
大大帮我看一下这段代码与图片之间的关系,谢谢
代碼:
<script language="javascript"> var page = 1; var s = location.search.substring(1,location.search.length); if (!isNaN(s) && s != "") { if (( s > 0 ) && ( s <= datas.length + 1 )) { page = s; } } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_showHideLayers() { //v6.0 var i,p,v,obj,args=MM_showHideLayers.arguments; for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args [i+2]; if (obj.style) { obj=obj.style; v=(v=='show')?'block':(v=='hide')?'none':v; } obj.display=v; } } function foo(o) { var v = parseInt(o.width); if (v > 720) { document.all.it1.width = v; document.all.it2.width = v+70 } MM_showHideLayers('Layer2','','hide'); tmp=0; } function showpic(v) { var nl = new String(window.location); if (nl.indexOf("?") >-1) { nl = nl.substring(0,nl.indexOf("?")); } nl = nl+'?'+v; //alert (nl); window.location = nl; } function ch_sel(v) { document.all.select1.value = v; document.all.select2.value = v; } function get_sel(v) { if (v == 0) { //document.write var i,outstr = ""; for (i=1;i<datas.length;i++) { outstr += "<option value='"+ i +"'>第"+ i +"页</option>"; } document.write(outstr); } else { if ((v > 0) && (v < datas.length+1)) { page = v; showpic(v); ch_sel(v); } } } function prevpage() { page--; if (page <1) { alert('到头咧'); page = 1; } else { //alert(page); ch_sel(page); showpic(page); } } function nextpage() { page++; //alert (page); if (page >= datas.length ) { alert('到头咧'); page = datas.length-1; } else { //alert(page); ch_sel(page); showpic(page); } } function keylock() { if((event.keyCode == 78 || event.keyCode == 110) && (event.ctrlKey)) { event.returnValue = false; } if((event.keyCode == 121) && (event.shiftKey)) { event.returnValue = false; } } function keyUp() { if (window.event.keyCode == 93) { addFavorite(); } if (window.event.keyCode == 17) { if (tmp == 1) document.getElementById("next").click(); tmp = 1; } if (window.event.keyCode == 16) { if (tmp == 3) document.getElementById("prev").click(); tmp = 3; } } </script> |