// JavaScript Document /* 建立 xmlHttpRequest,用以 AJAX 功能 */ function create_xmlHttpRequest() { /* Create a new XMLHttpRequest object to talk to the Web server */ var xmlHttp = false; /*@cc_on @*/ /*@if (@_jscript_version >= 5) try { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e2) { xmlHttp = false; } } @end @*/ if (!xmlHttp && typeof XMLHttpRequest != 'undefined') { xmlHttp = new XMLHttpRequest(); } return xmlHttp; } function ajax_post(param, url, handle_function, args) { var xmlHttp = create_xmlHttpRequest(); if ( xmlHttp ) { var dt = new Date(); param = encodeURI(param + "&rd=" + dt.getTime()); xmlHttp.onreadystatechange = function() { handle_function(xmlHttp, args); } xmlHttp.open("POST", url, true); xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlHttp.setRequestHeader("Content-Length", param.length); xmlHttp.send(param); } }