有两个方法,一个使用JS实现,一个是用iframe实现。
首先是JS实现,废话就不多说了,上代码
| functioncreateXMLHttpRequest(){    if(window.XMLHttpRequest){        XMLHttpR = newXMLHttpRequest();    }elseif(window.ActiveXObject){        try{            XMLHttpR = newActiveXObject("Msxml2.XMLHTTP");        }catch(e){            try{                XMLHttpR = newActiveXObject("Microsoft.XMLHTTP");            }catch(e){            }        }    }}functionsendRequest(url){    createXMLHttpRequest();    XMLHttpR.open("GET",url,true);    XMLHttpR.setRequestHeader("Content-Type","text/html;charset=utf-8");    XMLHttpR.onreadystatechange = processResponse;    XMLHttpR.send(null);}functionprocessResponse(){    if(XMLHttpR.readyState ==4 && XMLHttpR.status == 200){        document.write(XMLHttpR.responseText);    }} | 
上面的代码就是实现页面跳转后,浏览器地址栏地址保持不变的方法。
方法二:
使用iframe框架:
<iframe id="frame3d" name="frame3d" frameborder="0" width="100%" scrolling="auto"
 style="margin-top: -4px;" onload="this.style.height=document.body.clientHeight-84"
 height="100%" src="http://www.5202m.com" mce_src="http://www.baidu.com">
</iframe>
缺点是,存在跨域访问的问题。
推荐后台使用,前台对搜索引擎不友好,不利于优化
 
                    
                     
                    
                 
                    
                 
 
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号