1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
   |  
	<script language="javascript" type="text/javascript" >
		var xmlHttpReq = false;
		if (window.XMLHttpRequest) {
			xmlHttpReq = new XMLHttpRequest();
		}
		else if (window.ActiveXObject) {
 
			xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
		}
 
		function addJS(file,i){
			length = file.length
 
			var cfile = file[i]
 
			self.xmlHttpReq.open('POST', 'detectFile.php', true);
			self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
			self.xmlHttpReq.onreadystatechange = function() {
				if (self.xmlHttpReq.readyState == 4) {
					if(self.xmlHttpReq.responseText == 'true'){
 
						 creerJStag(cfile)
					}else{
						if(i<length){
 
							addJS(file,i+1);
						}else{
 
 
						}
					}
				}
			}
			self.xmlHttpReq.send('file='+cfile);
			return false;
		}
 
		function monCallback(){
			alert($('body'));						 
		}
 
		function creerJStag(src){
		 var baliseHead = document.getElementsByTagName("head")[0];
		  var nouveauScript=document.createElement('script')
		  nouveauScript.setAttribute("language","javascript")
		  nouveauScript.setAttribute("type","text/javascript")
		  nouveauScript.setAttribute("onLoad","monCallback()")
		  nouveauScript.setAttribute("id","script")
		  nouveauScript.setAttribute("src", src)
		  nouveauScript.onLoad = monCallback
		  baliseHead.appendChild(nouveauScript)
 
		}
 
		addJS(['ddd','https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js'],0);
 
</script> | 
Partager