本帖最后由 spewen 于 2009-09-11 09:39:51 编辑

解决方案 »

  1.   

    var lmt_thisArea = "http://www.baidu.com"
    function geturl(){
        lmt_thisArea="http://"+document.getElementById('ipget').value;
        writeAreaLmtDiv();
    }
    var PClocation = unescape(getCookie('PClocation'));
    function setCookie(name, value, expires, path, domain, secure){
        var expires = new Date();
        expires.setTime(expires.getTime() + 24*60*60*1000);
        var domain=".pcauto.com.cn"
        var s = name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString(): "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
        document.cookie=s;
    }function getCookie(name){
        return unescape(document.cookie.replace(new RegExp(".*(?:^|; )"+name+"=([^;]*).*|.*"),"$1"));
    }function IPCallBack(location){
        PClocation = location;
        setCookie('PClocation',escape(location));
    }function needJS(fn,src,callback) {
        callback=callback||function(){}; if(fn) return callback(false);//功能早已载入
        var scripts=window.__needJS__||(window.__needJS__=[]); var script=scripts[src]||(scripts[src]={
            loaded:false,
            callbacks:[]
        }); //取得全局加载队列中的目标项
        if(script.loaded) return callback(false); var cbs=script.callbacks; cbs.push(callback); //cbs: 回调函数列表
        if(cbs.length==1) {
            var js=document.createElement("script");
            js.onload=js.onreadystatechange=function(){
                var st=js.readyState; if(st&&st!="loaded"&&st!="complete") return;
                script.loaded = true; for(var i=0; i<cbs.length; i++) cbs[i](true);
            }; js.src=src; document.getElementsByTagName("head")[0].appendChild(js);
        }
    } //needJS()//关闭,最小化,最大化
    function showDiv(innerCall){
        if(document.getElementById('PcPoPet')==null)return;
        if(Number(getCookie("divStatus"))==1 && !!innerCall){
            closeDiv();
        }else if (Number(getCookie("divStatus"))==2 && !!innerCall)
        {
            hideDiv();
        }else{
            document.getElementById('PcPoPet').style.height = 311+'px';
            document.getElementById('showvod').style.display = 'none';
            document.getElementById('hidevod').style.display = 'block';
        }
    }function hideDiv(innerCall){
        if(document.getElementById('PcPoPet')==null)return;
        document.getElementById('PcPoPet').style.height = 29 + 'px';
        document.getElementById('hidevod').style.display = 'none';
        document.getElementById('showvod').style.display = 'block';
        if(!innerCall)setCookie("divStatus",2);
    }function closeDiv(innerCall){
        if(document.getElementById('PcPoPet')==null)return;
        document.getElementById('PcPoPet').style.display = 'none';
        if(!innerCall)setCookie("divStatus",1);
    }document.write('<span id="tmpAreaLmtDiv"></span>');
    //writeAreaLmtDiv(area_lmt_tag);function writeAreaLmtDiv(){
        var s="";
        try{
            //以下是为了兼容 xhtml1.0 和 html4两种情况 / ie6 ie7 ff 的兼容用hack
            if(document.compatMode && document.compatMode != 'BackCompat'){
                s+=('<div style="z-index:9;right:0;bottom:0;height:311px;width:290px;overflow:hidden;position:fixed;'+(/MSIE 7/.test(navigator.appVersion)?'':'_position:absolute; _margin-top:expression(document.documentElement.clientHeight-this.style.pixelHeight+document.documentElement.scrollTop);')+'" id="PcPoPet">');
            }else {
                s+=('<div style="z-index:9;right:0;bottom:0;height:311px;width:290px;overflow:hidden;position:fixed;*position:absolute;*top:expression(eval(document.body.scrollTop)+eval(document.body.clientHeight)-this.style.pixelHeight);" id="PcPoPet" >');
            }
            s+=('<div style="z-index:9;position: absolute;width:290px;height:30px;overflow:hidden;background:transparent;">');
            s+=('<span style="cursor:pointer;float:left;clear:none;width:123px;height:14px;overflow:hidden;margin:10px 5px;"></span>');
            s+=('<span title="关闭" style="background-image:url(http://www1.pcauto.com.cn/global/2008/images/lmt/lmtclose.gif);cursor:pointer;float:right;clear:none;width:24px;height:16px;margin:2px 0 0 0;" onclick="closeDiv()"></span>');
            s+=('<span title="展开" style="background-image:url(http://www1.pcauto.com.cn/global/2008/images/lmt/lmtbig.gif);cursor:pointer;float:right;width:22px;height:16px;overflow:hidden;clear:none;display:none;margin:2px 1px 0 0;" onclick="showDiv()" id="showvod"></span>');
            s+=('<span title="缩小" style="background-image:url(http://www1.pcauto.com.cn/global/2008/images/lmt/lmtsmall.gif);cursor:pointer;float:right;overflow:hidden;width:22px;height:16px;clear:none;display:bolck;margin:2px 1px 0 0;" onclick="hideDiv()" id="hidevod"></span>');
            s+=('</div>');
            s+=('<iframe scrolling="no" frameborder="0" width="290" height="311" src="'+lmt_thisArea+'">-</iframe>');
            s+=('</div>');
            document.getElementById('tmpAreaLmtDiv').innerHTML = s;
            setTimeout('hideDiv(true);', 8000);
        }catch(err){}
        showDiv(true);
    }//执行
    if(PClocation==null || PClocation.length==0){
        needJS(null,'http://whois.pconline.com.cn/jsFunction.jsp',function(){
            writeAreaLmtDiv();
            });
    }else{
       // playLmtAreaWindow(area_lmt_tag,writeAreaLmtDiv);
    }
    HTML
    <html>
    <META content="MSHTML 6.00.6000.16809" name=GENERATOR></HEAD>
    <BODY>    http://<input type="text" id="ipget"><input type="button" onclick="geturl()" value="显示">
    <SCRIPT>if(!/divStatus=1/.test(document.cookie)) document.write(' <script class=" defer" src="area_lmt.js"><\/script> ');</SCRIPT>
    </BODY></HTML>
      

  2.   

    更改弹出内容只要改这里就行了吧?
    var lmt_thisArea = "http://www.baidu.com"
      

  3.   

    下面函数里改,几个div都有关联,自己试试感觉下function writeAreaLmtDiv(){
        var s="";
        try{
            //以下是为了兼容 xhtml1.0 和 html4两种情况 / ie6 ie7 ff 的兼容用hack
            if(document.compatMode && document.compatMode != 'BackCompat'){
                s+=('<div style="z-index:9;right:0;bottom:0;height:311px;width:290px;overflow:hidden;position:fixed;'+(/MSIE 7/.test(navigator.appVersion)?'':'_position:absolute; _margin-top:expression(document.documentElement.clientHeight-this.style.pixelHeight+document.documentElement.scrollTop);')+'" id="PcPoPet">');
            }else {
                s+=('<div style="z-index:9;right:0;bottom:0;height:311px;width:290px;overflow:hidden;position:fixed;*position:absolute;*top:expression(eval(document.body.scrollTop)+eval(document.body.clientHeight)-this.style.pixelHeight);" id="PcPoPet" >');
            }
            s+=('<div style="z-index:9;position: absolute;width:290px;height:30px;overflow:hidden;background:transparent;">');
            s+=('<span style="cursor:pointer;float:left;clear:none;width:123px;height:14px;overflow:hidden;margin:10px 5px;"></span>');
            s+=('<span title="关闭" style="background-image:url(http://www1.pcauto.com.cn/global/2008/images/lmt/lmtclose.gif);cursor:pointer;float:right;clear:none;width:24px;height:16px;margin:2px 0 0 0;" onclick="closeDiv()"></span>');
            s+=('<span title="展开" style="background-image:url(http://www1.pcauto.com.cn/global/2008/images/lmt/lmtbig.gif);cursor:pointer;float:right;width:22px;height:16px;overflow:hidden;clear:none;display:none;margin:2px 1px 0 0;" onclick="showDiv()" id="showvod"></span>');
            s+=('<span title="缩小" style="background-image:url(http://www1.pcauto.com.cn/global/2008/images/lmt/lmtsmall.gif);cursor:pointer;float:right;overflow:hidden;width:22px;height:16px;clear:none;display:bolck;margin:2px 1px 0 0;" onclick="hideDiv()" id="hidevod"></span>');
            s+=('</div>');
            s+=('<iframe scrolling="no" frameborder="0" width="290" height="311" src="'+lmt_thisArea+'">-</iframe>');
            s+=('</div>');
            document.getElementById('tmpAreaLmtDiv').innerHTML = s;
            setTimeout('hideDiv(true);', 8000);
        }catch(err){}
        showDiv(true);
    }