hello,
I use ajax content script but in ajaxpage doesn;t work <script> tag. My ajax script is this
I found in Google this mod for work <script> tag but i don;t know how add in my scriptCode:var bustcachevar=1 //bust potential caching of external pages after initial request? (1=yes, 0=no) var loadstatustext="<center><br><br><br><br><br><img src='pic/ajax-loader.gif' /><br><br><br></center>" var loadingPanel = new yuiLoadingPanel(); function load(){ loadingPanel.show(); } function deload(){ loadingPanel.hide(); } ////NO NEED TO EDIT BELOW//////////////////////// var defaultcontentarray=new Object() var bustcacheparameter = "" function ajaxpage(page,where){ var page_request = false if (window.XMLHttpRequest) // if Mozilla, Safari etc page_request = new XMLHttpRequest() else if (window.ActiveXObject){ // if IE try { page_request = new ActiveXObject("Msxml2.XMLHTTP") } catch (e){ try{ page_request = new ActiveXObject("Microsoft.XMLHTTP") } catch (e){} } } else return false load(); var xmlhttp=false; //Clear our fetching variable try { xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); //Try the first kind of active x object… } catch (e) { try { xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); //Try the second kind of active x object } catch (E) { xmlhttp = false; } } if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp = new XMLHttpRequest(); //If we were able to get a working active x object, start an XMLHttpRequest } xmlhttp.open('GET', page, true); //Open the file through GET, and add the page we want to retrieve as a GET variable ** xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status == 200) { //Check if it is ready to recieve data var main_div = xmlhttp.responseText; //The content data which has been retrieved *** if(main_div){ //Make sure there is something in the content variable split_text(xmlhttp,where); } } } xmlhttp.send(null) //Nullify the XMLHttpRequest return; } function split_text(xmlhttp, where){ if (xmlhttp.readyState == 4 && (xmlhttp.status==200 || window.location.href.indexOf("http")==-1)){ var Result = xmlhttp.responseText.split("||javascript||"); document.getElementById(where).innerHTML=Result[0]; if(Result[1]) eval(Result[1]); deload() } } function loadjscssfile(filename, filetype){ if (filetype=="js"){ //if filename is a external JavaScript file var fileref=document.createElement('script') fileref.setAttribute("type","text/javascript") fileref.setAttribute("src", filename) } else if (filetype=="css"){ //if filename is an external CSS file var fileref=document.createElement("link") fileref.setAttribute("rel", "stylesheet") fileref.setAttribute("type", "text/css") fileref.setAttribute("href", filename) } if (typeof fileref!="undefined") document.getElementsByTagName("head")[0].appendChild(fileref) } var nav_links = Array(); var now_link = 1; nav_links[now_link] = 'main.php?action=main'; var now_loaded = ''; var now_loaded_rel; function chatvirte(es){ // if(now_loaded != es.getAttribute("url")){ ajaxpage(es.getAttribute("url"), es.getAttribute("rel")); if(es.getAttribute("rel")=='main_div'){ now_link++; nav_links[now_link]=es.getAttribute("url"); } // now_loaded = es.getAttribute("url"); // now_loaded_rel = es.getAttribute("rel"); top(); // } return false; } function reload(){ ajaxpage(es.getAttribute("url"), es.getAttribute("rel")); } function top() { if (document.body.scrollTop!=0 || document.documentElement.scrollTop!=0){ window.scroll(0,0); } else clearTimeout(); } function reload2(){ ajaxpage(nav_links[now_link], 'main_div'); } function ajax_go_back(){ if(now_link>1){ now_link--; ajaxpage(nav_links[now_link], 'main_div'); } } function ajax_go_forward(){ var go_forwad = now_link+1; if(nav_links[go_forwad ]){ now_link++; ajaxpage(nav_links[now_link], 'main_div'); } } var clickonce = false; function js_save() { if(clickonce==false) { document.formTrial.submit(); clickonce=true; } }
Please if someone know how make it please add me in my ajax script.Code:for (var i in scriptElements) { var scriptElement = scriptElements[i]; var newScript = document.createElement(’SCRIPT’); newScript.setAttribute(’src’, scriptElement.getAttribute(’src’)); newScript.setAttribute(’type’, scriptElement.getAttribute(’type’)); newScript.setAttribute(’id’, scriptElement.getAttribute(’id’)); newScript.data = scriptElement.data; if (_isMSIE_) { newScript.onreadystatechange = function () { if (newScript.readyState == ‘loaded’) { _do your thing_ newScript.onreadystatechange = null; } } } else { newScript.onload = function() {_do the same thing_} } scriptElement.parentNode.removeChild(scriptElement); var head = document.getElementsByTagName(”head”)[0]; head.appendChild(newScript); }
Thanks



Reply With Quote

Bookmarks