Force Ajax page refresh by shawl. Qiu

Source: Internet
Author: User
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/

 
 
  1. <! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <HTML xmlns = "http://www.w3.org/1999/xhtml">
  3. <! -- Dw6 -->
  4. <Head>
  5. <Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
  6. <Title> shawl. Qiu template </title>
  7. <SCRIPT type = "text/JavaScript">
  8. // <! [CDATA [
  9. VaR XMLHTTP = {
  10. // ------------------------------------- Begin request
  11. Request: function (){
  12. Try {
  13. Return new XMLHttpRequest ();
  14. } Catch (e ){
  15. Try {
  16. Return new activexobject ('Microsoft. xmlhttp ');
  17. } Catch (e ){
  18. Try {
  19. Return new activexobject ("msxml2.xmlhttp ");
  20. } Catch (e ){}
  21. }
  22. }
  23. },
  24. // ------------------------------------- End request
  25. // Begin text
  26. Text: function (method, URL, func ){
  27. VaR request = XMLHTTP. Request ();
  28. Request. Open (method, URL );
  29. Request. onreadystatechange = function (){
  30. If (request. readystate = 4 & request. Status = 200 ){
  31. If (func) func (request. responsetext );
  32. Else alert (request. responsetext );
  33. }
  34. }
  35. Request. Send (null );
  36. },
  37. // ------------------------------------- End text
  38. // Begin reload
  39. Reload: function (method, URL ){
  40. If (navigator. appname! = 'Netscape '){
  41. VaR request = XMLHTTP. Request ();
  42. Request. Open (method, URL, true );
  43. Try {W. Close ();} catch (e ){}
  44. W = open ('','');
  45. W. Blur ();
  46. W. opener. Focus ();
  47. Request. onreadystatechange = function (){
  48. If (request. readystate = 4 & request. Status = 200 ){
  49. W. Close ();
  50. Location. Reload (true );
  51. }
  52. }
  53. Request. Send (null );
  54. } Else location. Reload (true );
  55. }
  56. // ------------------------------------- End reload
  57. } // Shawl. Qiu script
  58. // ------------------------------------------ End object XMLHTTP ----------------------------//
  59. Onload = function () {// load sqeditor button. Please load it with an absolute address.
  60. XMLHTTP. Text ('get', 'sqeditor/sqeditormarkuplist.htm', fgetmarkuplist );
  61. }
  62. Function fgetmarkuplist (OBJ ){
  63. VaR o = Document. getelementbyid ('sqeditor ');
  64. O. innerhtml = OBJ;
  65. } // Shawl. Qiu script
  66. //]>
  67. </SCRIPT>
  68. </Head>
  69. <Body>
  70. <Div id = "sqeditor"> </div> <! -- Display the IFRAME tag list -->
  71. <Br/> <button onclick = "XMLHTTP. Reload ('get', 'sqeditor/sqeditormarkuplist.htm');"> reload </button>
  72. </Body>
  73. </Html>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.