ããã«æ¨æ¥ã®ç¶ãããããã試ãã¦ã¿ãã¨ãæ¨æ¥ã¿ããã«è¤éãªãã¨ãããªãã¦ããwindow.setInterval ãªã©ãå¼ã³åºãã©ããé¢æ°ãä½ã£ã¦ããã°ãæ®éã« setInterval ã setTimeout ãå¼ã³åºãã¾ãããã¨ããããã§ã以ä¸ã®ãããªå½ windowãå½ document ãæºåããã³ã¼ããç¨æãã¦ããã°ãjQuery.ajax ãéåæã§åãããããsetTimeout ã§é 延å®è¡ãããããèªç±èªå¨ã§ããã
// ã¦ã¼ãã£ãªãã£é¢æ° var _util = { cat : function(f){return (new ActiveXObject("Scripting.FileSystemObject")).OpenTextFile(f,1,false).ReadAll();} }; // å½ windowãå½documentãã°ãã¼ãã«ãªãã¸ã§ã¯ãã®æºå (function(){ if( typeof( document ) == "undefined" ){ document = new ActiveXObject( "htmlfile" ); document.write("<html></html>"); } if( typeof( window ) == "undefined" ) window = document.parentWindow; if( typeof( alert ) == "undefined" ) //alert = window.alert; alert = function(s){ return window.alert( s )}; if( typeof( confirm ) == "undefined" ) confirm = function(s){ return window.confirm(s) }; if( typeof( location ) == "undefined" ) location = window.location; if( typeof( navigator ) == "undefined" ) navigator = window.navigator; if( typeof( clearInterval ) == "undefined" ) clearInterval = function(id){ return window.clearInterval( id ); }; if( typeof( clearTimeout ) == "undefined" ) clearTimeout = function(id){ return window.clearTimeout(id); }; if( typeof( setInterval ) == "undefined" ) setInterval = function(code, interval){ return window.setInterval(code, interval); } if( typeof( setTimeout ) == "undefined" ) setTimeout = function(code, delay){ return window.setTimeout(code, delay); } })(); // setInterval ã§ç¹°ãè¿ãå®è¡ãèªç±èªå¨ var n = 6; var id = setInterval( function(){ if( --n ) alert( 'interval' ); else clearInterval( id );}, 500 ); while( n ){ WScript.Sleep( 100 ); } // jQueryã®èªã¿è¾¼ã¿ eval( _util.cat( "jquery-1.3.2.js" ) ); // ã¯ã¦ãªãã¤ã¢ãªã¼ãã¯ã¦ãªããã¯ãã¼ã¯ããããã®RSSã並è¡ãã¦èªã¿è¾¼ã¿ã¾ãã var complete = 0; $.ajax( { url : "http://d.hatena.ne.jp/hasegawayosuke/rss", dataType : "xml", type : "get", async : true, success : function( xml ){ var s = ""; $( xml ).find( "item" ).each( function(){ s += $(this).find( "title" ).text() + " <" + $(this).find( "link" ).text() + "> (" + $(this).find( "dc\\:date" ).text() + ")\n"; } ); alert( s ); complete += 1; } } ); $.ajax( { url : "http://b.hatena.ne.jp/hasegawayosuke/rss", dataType : "xml", type : "get", async : true, success : function( xml ){ var s = ""; $( xml ).find( "item" ).each( function(){ s += $(this).find( "title" ).text() + " <" + $(this).find( "link" ).text() + "> (" + $(this).find( "dc\\:date" ).text() + ")\n"; } ); alert( s ); complete += 1; } } ); for( var i = 0; i < 100; i++ ){ WScript.Sleep( 30 ); if( complete == 2 ) break; } alert( 'done' );
â» IE8 on Vista SP1 㨠IE7 on XP SP3 ãªç°å¢ã§ç¢ºèªãã¾ããã