Display Ajax technology in Weaver OA, createhtml creates and calls ASP files without refreshing

Source: Internet
Author: User

<SCRIPT src = "ajax_about.js"> </SCRIPT>
<! -- Display-create an HTML document. No need for new technologies -->
<Div id = my_div> </div>
<SCRIPT>
VaR curobject = Document. getelementbyid ("my_div ");
Createhtml ("show. asp", curobject); // you can call ASP files with PHP,. net
</SCRIPT>
<! -- Display-create an HTML document. No need for new technologies -->

========================================================== ==========================================
<! -- Ajax JS Code Can be changed to gb2312 to utf8. below is the Ajax code in Weaver OA --->
<Script language = "JavaScript">
<! --
VaR loadstr = '<Table width = "100%" Height = "50%" border = "0" cellpadding = "0"> <tr> <TD align = "center"> <Div style = "background-color: # f7f7f7; width: 200px; Height: 20px; padding: 5px; Border: 1px solid # cccccc; "> processing... </div> </TD> </tr> </table> ';

Function gb2utf8 (data ){
VaR glbencode = [];
Gb2utf8_data = data;
ExecScript ("gb2utf8_data = midb (gb2utf8_data, 1)", "VBScript ");
VaR T = escape (gb2utf8_data ). replace (/% u/g ,""). replace (/(. {2 })(. {2})/g, "%$ 2% $1 "). replace (/% ([A-Z].) % (. {2})/g, "@ $1 $2 ");
T = T. Split ("@");
VaR I = 0, j = T. length, K;
While (++ I <j ){
K = T [I]. substring (0, 4 );
If (! Glbencode [k]) {
Gb2utf8_char = eval ("0x" + k );
ExecScript ("gb2utf8_char = CHR (gb2utf8_char)", "VBScript ");
Glbencode [k] = escape (gb2utf8_char). substring (1, 6 );
}
T [I] = glbencode [k] + T [I]. substring (4 );
}
Gb2utf8_data = gb2utf8_char = NULL;
Return Unescape (T. Join ("% "));
}

var prefixes = ["msxml2.xmlhttp", "Microsoft. XMLHTTP "," msxml3.xmlhttp "," MSXML. XMLHTTP "];
function getdomobject () {
for (VAR I = 0; I try {XMLHTTP = new activexobject (prefixes [I]);} catch (Ex ){};
}< br> return XMLHTTP;
}

function createhtml (strurl, objdiv) {
objdiv. innerhtml = loadstr;
var element = This;
var XMLHTTP = getdomobject ();
XMLHTTP. open ("get", strurl, true);
XMLHTTP. onreadystatechange = function () {
switch (XMLHTTP. readystate) {
case 3:
objdiv. innerhtml = loadstr;
break;
case 4:
If (XMLHTTP. status = 200) {
objdiv. innerhtml = gb2utf8 (XMLHTTP. responsebody);
}

}
}
XMLHTTP. setRequestHeader ("Content-Type", "text/XML ")
XMLHTTP. Send (null );
}

 

// -->
</SCRIPT>

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.