Jilian.htm
Copy codeThe Code is as follows:
<Script language = "javascript">
Var http_request = false;
Function send_request (url) {// initialization, specifying the processing function and sending the request function
Http_request = false;
// Start initializing the XMLHttpRequest object
If (window. XMLHttpRequest) {// Mozilla Browser
Http_request = new XMLHttpRequest ();
If (http_request.overrideMimeType) {// set the MIME type
Http_request.overrideMimeType ("text/html ");
}
}
Else if (window. ActiveXObject) {// IE browser
Try {
Http_request = new ActiveXObject ("Xsxml2.XMLHTTP ");
Http_request.setRequestHeader ("Content-Type", "text/xml ");
Http_request.setRequestHeader ("Content-Type", "gb2312 ");
}
Catch (e ){
Try {
Http_request = new ActiveXObject ("Microsoft. XMLHTTP ");
Http_request.setRequestHeader ("Content-Type", "text/xml ");
Http_request.setRequestHeader ("Content-Type", "gb2312 ");
}
Catch (e ){
}
}
}
If (! Http_request) {// exception. An error occurred while creating the object instance.
Window. alert ("XMLHttpRequest object instance cannot be created ");
Return false;
}
Http_request.onreadystatechange = processRequest;
// Determine the request sending method and URL and whether to execute the following code synchronously
Http_request.open ("GET", url, true );
Http_request.send (null );
}
// Function for processing the returned information
Function processRequest (){
If (http_request.readyState = 4) {// judge the object status
If (http_request.status = 200) {// The information has been returned successfully. Start to process the information.
Document. getElementById (currentPos). innerHTML = http_request.responseText;
}
Else {// The page is abnormal.
Alert ("the page you requested has an exception ");
}
}
}
Function showRoles (obj ){
Document. getElementById (obj). parentNode. style. display = "";
Document. getElementById (obj). innerHTML = "reading data ..."
CurrentPos = obj;
Send_request ("jilian_data.asp? PlayPos = "+ obj );
}
</Script>
<Table width = "200" border = "0" cellspacing = "0" cellpadding = "0">
<Tr>
<Td height = "20">
<A href = "javascript: void (0)" onclick = "showRoles ('pos _ 1')"> Manager Office
</A>
</Td>
</Tr>
<Tr style = "display: none">
<Td height = "20" id = "pos_1"> </td>
</Tr>
<Tr>
<Td height = "20">
<A href = "javascript: void (0)" onclick = "showRoles ('pos _ 2')"> Development Department </a>
</Td>
</Tr>
<Tr style = "display: none">
<Td id = "pos_2" height = "20"> </td>
</Tr>
</Td>
</Table>
Jilian_data.asp
Copy codeThe Code is as follows:
<% @ LANGUAGE = "VBSCRIPT" CODEPAGE = "936" %>
<%
PlayPos = request ("playPos ")
If playPos = "pos_1" then
Response. Write ("jingli <br> Deputy General Manager ")
End if
If playPos = "pos_2" then
Response. Write ("Chief Engineer <br> Software Engineer ")
End if
%>