Force Ajax page refresh by shawl. Qiu
Note:
There is nothing to explain. before Ajax is understood, there is a mysterious feeling. After learning about Ajax, it seems like it is a little too simple.
The main application is not refreshing get and post.
But for Ajax, the headache is why there are many different browsers.
While these browsers browse Web pages, there are many of their respective attribute methods.
However, when a new version is released for each browser, it is better compatible with other browsers. However,
This new version of browser has its own new method, which is simply an endless dream.
All right, let's talk about it.
This article only supports force page refreshing for IE & Firefox, and only one specific file can be refreshed.
In addition, Firefox can force new pages without any additional settings.
But for opera, I couldn't help it. I went to the official website's userjs to check a stack of articles and couldn't find a feasible method...
Shawl. Qiu
2006-10-28
Http://blog.csdn.net/btbtd/
- <! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <HTML xmlns = "http://www.w3.org/1999/xhtml">
- <! -- Dw6 -->
- <Head>
- <Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
- <Title> shawl. Qiu template </title>
- <SCRIPT type = "text/JavaScript">
- // <! [CDATA [
- VaR XMLHTTP = {
- // ------------------------------------- Begin request
- Request: function (){
- Try {
- Return new XMLHttpRequest ();
- } Catch (e ){
- Try {
- Return new activexobject ('Microsoft. xmlhttp ');
- } Catch (e ){
- Try {
- Return new activexobject ("msxml2.xmlhttp ");
- } Catch (e ){}
- }
- }
- },
- // ------------------------------------- End request
- // Begin text
- Text: function (method, URL, func ){
- VaR request = XMLHTTP. Request ();
- Request. Open (method, URL );
- Request. onreadystatechange = function (){
- If (request. readystate = 4 & request. Status = 200 ){
- If (func) func (request. responsetext );
- Else alert (request. responsetext );
- }
- }
- Request. Send (null );
- },
- // ------------------------------------- End text
- // Begin reload
- Reload: function (method, URL ){
- If (navigator. appname! = 'Netscape '){
- VaR request = XMLHTTP. Request ();
- Request. Open (method, URL, true );
- Try {W. Close ();} catch (e ){}
- W = open ('','');
- W. Blur ();
- W. opener. Focus ();
- Request. onreadystatechange = function (){
- If (request. readystate = 4 & request. Status = 200 ){
- W. Close ();
- Location. Reload (true );
- }
- }
- Request. Send (null );
- } Else location. Reload (true );
- }
- // ------------------------------------- End reload
- } // Shawl. Qiu script
- // ------------------------------------------ End object XMLHTTP ----------------------------//
- Onload = function () {// load sqeditor button. Please load it with an absolute address.
- XMLHTTP. Text ('get', 'sqeditor/sqeditormarkuplist.htm', fgetmarkuplist );
- }
- Function fgetmarkuplist (OBJ ){
- VaR o = Document. getelementbyid ('sqeditor ');
- O. innerhtml = OBJ;
- } // Shawl. Qiu script
- //]>
- </SCRIPT>
- </Head>
- <Body>
- <Div id = "sqeditor"> </div> <! -- Display the IFRAME tag list -->
- <Br/> <button onclick = "XMLHTTP. Reload ('get', 'sqeditor/sqeditormarkuplist.htm');"> reload </button>
- </Body>
- </Html>