var AJAX={ http_request:false, DivObj:null, waitstate:null, success:null, get:function (divid,url) { AJAX.http_request = false; if(divid!=null)AJAX.DivObj = document.getElementById(divid); if(window.XMLHttpRequest) { //Mozilla 浏览器 AJAX.http_request = new XMLHttpRequest(); if (AJAX.http_request.overrideMimeType) {//设置MiME类别 AJAX.http_request.overrideMimeType('text/xml'); } }else if (window.ActiveXObject) { // IE浏览器 try { AJAX.http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { AJAX.http_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!AJAX.http_request) { window.alert("不能创建XMLHttpRequest对象实例."); return false; } AJAX.http_request.onreadystatechange = AJAX.processRequest; AJAX.http_request.open("GET", url+"&"+Math.random(), true); AJAX.http_request.send(null); }, post:function (divid,url,postvalue) { AJAX.http_request = false; if(divid!=null)AJAX.DivObj = document.getElementById(divid); if(window.XMLHttpRequest) { //Mozilla 浏览器 AJAX.http_request = new XMLHttpRequest(); if (AJAX.http_request.overrideMimeType) {//设置MiME类别 AJAX.http_request.overrideMimeType('text/xml'); } }else if (window.ActiveXObject) { // IE浏览器 try { AJAX.http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { AJAX.http_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!AJAX.http_request) { window.alert("不能创建XMLHttpRequest对象实例."); return false; } AJAX.http_request.onreadystatechange = AJAX.processRequest; AJAX.http_request.open("POST", url+"&"+Math , true); AJAX.http_request.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); AJAX.http_request.send(postvalue); }, processRequest:function () { if (AJAX.http_request.readyState == 4) { if (AJAX.http_request.status == 200) { if(AJAX.DivObj!=null){ AJAX.DivObj.innerHTML=AJAX.http_request.responseText; } } else { alert("您所请求的页面有异常。"); } }else{ if(AJAX.DivObj!=null){ AJAX.DivObj.innerHTML='请等待...'; } } } } //以下makesmallpic方法将要删除,请不要再使用 function makesmallpic(obj,w,h){ var srcImage = new Image(); srcImage.src=obj.src; var srcW=srcImage.width; var srcH=srcImage.height; if (srcW==0) { obj.src=srcImage.src; srcImage.src=obj.src; var srcW=srcImage.width; var srcH=srcImage.height; } if (srcH==0) { obj.src=srcImage.src; srcImage.src=obj.src; var srcW=srcImage.width; var srcH=srcImage.height; } if(srcW>srcH){ if(srcW>w){ obj.width=newW=w; obj.height=newH=(w/srcW)*srcH; }else{ obj.width=newW=srcW; obj.height=newH=srcH; } }else{ if(srcH>h){ obj.height=newH=h; obj.width=newW=(h/srcH)*srcW; }else{ obj.width=newW=srcW; obj.height=newH=srcH; } } if(newW>w){ obj.width=w; obj.height=newH*(w/newW); }else if(newH>h){ obj.height=h; obj.width=newW*(h/newH); } } /*** *评论* ****/ var limitTime=null; function quotecomment(oo){ document.getElementById("comment_content").value=oo; document.getElementById("comment_content").focus(); } function limitComment(){ limitTime=limitTime-1; if(limitTime>0){ document.getElementById("comment_content").value='还剩'+limitTime+'秒,你才可以再发表评论'; document.getElementById("comment_content").disabled=true; document.getElementById("comment_submit").disabled=true; setTimeout("limitComment()",1000); }else if(limitTime==0){ document.getElementById("comment_content").value=''; document.getElementById("comment_content").disabled=false; document.getElementById("comment_submit").disabled=false; } } //旧版的需要用到 function postcomment(thisurl,yzimgnum){ var yzimgstr=''; //if(yzimgnum=='1'){ if(document.getElementById("yzImgNum")!=null){ yzimgstr+="&yzimg="+ document.getElementById("yzImgNum").value; } if(document.getElementById("commentface")!=null){ yzimgstr+="&commentface="+ document.getElementById("commentface").value; } username4 = document.getElementById("comment_username").value; content4 = document.getElementById("comment_content").value; if(content4==''){ alert("内容不能为空"); return false; } content4=content4.replace(/(\n)/g,"@@br@@"); //document.getElementById("comment_content").value=''; //document.getElementById("comment_content").disabled=true; limitTime=10; limitComment(); AJAX.get("comment",thisurl + "&username=" + username4 + "&content=" + content4 + yzimgstr); //if(yzimgnum=='1'){ if(document.getElementById("yzImgNum")!=null){ //document.getElementById("yz_Img").src; document.getElementById("yzImgNum").value=''; } } function getcomment(thisurl){ AJAX.get("comment",thisurl,1); } /*** *在线操作* ****/ var clickEdit={ showSonId:null, showObjWidth:0, showObjHeight:0, topObj:null, init:function(){ oo=document.body.getElementsByTagName("A"); for(var i=0;i关闭 '; //objs=obj.getElementsByTagName("TD"); //objs[1].id=DivId; obj.innerHTML='
'; obj.style.Zindex='9990'; obj.style.display='none'; //网速慢的话,就把这行删除掉,直接先显示,再加载其它内容 obj.style.position='absolute'; obj.style.top=position.bottom+'px'; obj.style.left=position.left+'px'; //obj.style.height='100px'; //obj.style.width=clickEdit.width+'px'; document.body.appendChild(obj); //clickEdit.getparent(DivId).show("slow"); //obj.innerHTML='以下是显示内容...'; $.get(thisurl+(thisurl.indexOf("?")==-1?"?":"&")+Math.random(),function(d){ if(d.indexOf('请先登录')!=-1||d==""){ clickEdit.getparent(DivId).hide(); document.body.removeChild(obj); return ; } $("#"+DivId).html(d); if($(ao).width()>clickEdit.getparent(DivId).width()){ clickEdit.getparent(DivId).css("width",$(ao).width()+"px"); } // clickEdit.getparent(DivId).show(); clickEdit.autohide(ao); }); }else{ //兼容缩放窗口后,要重新定位 clickEdit.getparent(DivId).css({"left":position.left+'px',"top":position.bottom+'px'}); clickEdit.getparent(DivId).show(); clickEdit.autohide(ao); } }, getparent:function(sonId){ parentObj = $("#"+sonId).parent().parent(); return parentObj; }, save:function(oid,job,va){ divid="clickEdit_"+oid; //alert(oid) //GET方式提交内容,如果有空格的话.会有BUG //即时显示,不过没判断是否保存成功也显示了 document.getElementById(oid).innerHTML=va; va=va.replace(/(\n)/g,"@BR@"); AJAX.get(divid,"ajax.php?inc="+job+"&step=2&TagId="+oid+"&va="+va,0); }, cancel:function(sonId){ clickEdit.getparent(sonId).hide(); }, autohide:function(eObj){ parentObj = clickEdit.getparent(clickEdit.showSonId); //要提前赋值,不然渐变隐藏或显示,会引起宽高的变化 w1 = $(eObj).width(); w2 = parentObj.width(); clickEdit.showObjWidth = w1>w2 ? w1 : w2; clickEdit.showObjHeight = parentObj.height(); document.onmousemove = clickEdit.mouseMove; //不想鼠标离开隐藏的话,就把这行删除掉 }, mouseMove:function(ev){ ev = ev || window.event; var mousePos = clickEdit.mousePosition(ev); var x = mousePos.x; var y = mousePos.y; parentObj = clickEdit.getparent(clickEdit.showSonId); left1 = parseInt(parentObj.css("left")); top1 = parseInt(parentObj.css("top"))-$(clickEdit.topObj).height(); left2 = left1 + clickEdit.showObjWidth ; top2 = top1 + clickEdit.showObjHeight+$(clickEdit.topObj).height(); if ( xleft2 || ytop2){ clickEdit.cancel(clickEdit.showSonId); //document.title=x+"-"+y+" 横 "+left1+"-"+left2+" 高 "+top1+"-"+top2 + "p高"+ parentObj.height(); } }, mousePosition:function(ev){ //获取鼠标所在坐标 if(ev.pageX || ev.pageY){ //FF return {x:ev.pageX, y:ev.pageY}; } return { //IE x:ev.clientX + window.document.documentElement.scrollLeft,// - window.document.documentElement.clientLeft, y:ev.clientY + window.document.documentElement.scrollTop// - window.document.documentElement.clientTop }; } } //显示子栏目 function showSonName(fid) { oo=document.body.getElementsByTagName('DIV'); for(var i=0;i 0){ $("#body_layer").css("height",window.document.body.scrollHeight); }else{ $("#body_layer").css("height",window.document.body.clientHeight); } t_h = navigator.appName != "Microsoft Internet Explorer" ? pageYOffset + innerHeight / 2 -75 : window.document.documentElement.clientHeight / 2 + window.document.documentElement.scrollTop; $(layer_msg_divLayer).css("top",t_h); $("#body_layer").css("width",window.document.body.clientWidth); layer_msg_time = setTimeout( "layer_msg_refresh()" , 10 ); } function show_layer_msg(MsgTableId){ if (arguments.length<1){ alert("你没有传递ID进来!"); return ; } color=arguments.length>1?arguments[1]:"#333333"; layer_msg_divLayer = "#"+MsgTableId; $("#body_layer").css("height",window.document.body.scrollHeight); $("#body_layer").css("width",window.document.body.scrollWidth); $("#body_layer").css("display","block"); $("#body_layer").css("background",color); $(layer_msg_divLayer).css("left","50%"); $(layer_msg_divLayer).css("display","block"); document.body.oncontextmenu = function(){return false;} layer_msg_refresh() } function close_layer_msg(){ document.body.oncontextmenu = function(){return null;} clearTimeout(layer_msg_time); $("#body_layer").css("display","none"); $(layer_msg_divLayer).css("display","none"); } function alert2(msg){ $("#layer_msg_content").html(msg); show_layer_msg("body_msg_layer"); } document.write(''); document.write('');