Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Paste Description for Yancho

Javascript used in pugmt

Yancho
Tuesday, December 18th, 2007 at 7:04:30pm MST 

  1. <html xmlns="http://www.w3.org/1999/xhtml">
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  4. <title>Untitled Document</title>
  5. <!-- Dependency -->
  6.         <script src="http://yui.yahooapis.com/2.4.0/build/yahoo/yahoo-min.js"></script>
  7.  
  8.         <!-- Used for Custom Events and event listener bindings -->
  9.         <script src="http://yui.yahooapis.com/2.4.0/build/event/event-min.js"></script>
  10.  
  11.         <!-- Source file -->
  12.         <script src="http://yui.yahooapis.com/2.4.0/build/connection/connection-min.js"></script>
  13. </head>
  14.  
  15. <body>
  16. <div id="container"></div>
  17.  
  18. <script language="javascript" type="text/javascript">
  19.  
  20.  
  21. function ajaxFunction()
  22. {
  23.         //create an XMLHttp object
  24.         var http_request = false;
  25.        
  26.    if (window.XMLHttpRequest)
  27.    { // Mozilla, Safari,...
  28.        http_request = new XMLHttpRequest();
  29.        if (http_request.overrideMimeType) {
  30.            http_request.overrideMimeType('text/html');
  31.              }
  32.  
  33.    }
  34.    else if (window.ActiveXObject)
  35.    { // IE
  36.         try {
  37.            http_request = new ActiveXObject("Msxml2.XMLHTTP");
  38.         }
  39.         catch (e)
  40.                 {
  41.            try {
  42.                  http_request = new ActiveXObject("Microsoft.XMLHTTP");
  43.                            }
  44.                    catch (e) {}
  45.        }
  46.    }
  47.  
  48.    if (!http_request) {
  49.        alert('Browser doesn\'t support AJAX');
  50.        return false;
  51.    }
  52.    
  53. }
  54.  
  55. var div = document.getElementById('container');
  56.  
  57. function cleartimer(t) { clearInterval(t); }
  58.  
  59. var handleSuccess = function(o){
  60.         if(o.responseText !== undefined){
  61.                
  62.                 if (o.responseText != "") {
  63.                   //alert ('Updating route');
  64.                 div.innerHTML =  o.responseText;
  65.                 }
  66.                 else {
  67.                   //alert('not updating route');
  68.                   }
  69.                
  70.                      if (div.innerHTML == "<br><b>Welcome to destination - Hope you enjoyed your trip</b>")
  71.                         {
  72.                           alert ('Destination reached');
  73.                           return;
  74.                         }
  75.         window.setTimeout(function(){ start() }, 5000);
  76.         }
  77. }
  78.  
  79. var handleFailure = function(o){
  80.         if(o.responseText !== undefined){
  81.                 div.innerHTML = "<li>Transaction id: " + o.tId + "</li>";
  82.                 div.innerHTML += "<li>HTTP status: " + o.status + "</li>";
  83.                 div.innerHTML += "<li>Status code message: " + o.statusText + "</li>";
  84.         }
  85. }
  86.  
  87. var callback =
  88. {
  89.   success:handleSuccess,
  90.   failure: handleFailure
  91. };
  92.  
  93.  
  94.  
  95. function start()
  96. {
  97.      var o = YAHOO.util.Connect.asyncRequest('GET', "next_instruction.php", callback);
  98.      
  99.  
  100. }
  101.  
  102.  
  103. //main code 
  104. window.onload = function() {
  105.     alert('safe to do request now');
  106.     alert ('Starting running');
  107.     var ajaxRequest = ajaxFunction();
  108.     start();
  109.  
  110. }
  111.  
  112.  
  113. </script>
  114.  
  115. </body>
  116. </html>

advertising

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

worth-right
worth-right
fantasy-obligation