Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function createHTTP() {
- var http;
- try { // Firefox, Opera 8.0+, Safari et IE récent
- http=new XMLHttpRequest();
- } catch (e) { // Vieux IE
- try {
- http=new ActiveXObject("Msxml2.XMLHTTP");
- } catch (e) {
- try {
- http=new ActiveXObject("Microsoft.XMLHTTP");
- } catch (e) {
- http=null;
- }
- }
- }
- return http; // null si navigateur incompatible
- }
- function handleResponse( http, id ) {
- if (http.readyState==4) {
- if (http.status == 0) {
- //200 pour http et 0 pour file
- var empXml = http.responseText;
- //Remplacez le child emp par celui du XML.
- var emp = document.getElementById("emp");
- emp.innerHTML = empXml;
- }
- }
- }
- function include(id, xml) {
- var http = createHTTP();
- http.open("GET", xml, true);
- http.onreadystatechange = function(){handleResponse( http, id ); }
- http.send(null);
- }
Advertisement
Add Comment
Please, Sign In to add comment