Доброго времени суток.
У меня есть код. С помощью ActiveX я выводил на страницу другую страницу. Вот код:
| Код | var xmlDoc = null; function load(){ if (typeof window.ActiveXObject != 'undefined' ) { xmlDocA = new ActiveXObject("Microsoft.XMLHTTP"); xmlDocA.onreadystatechange = process; xmlDocP = new ActiveXObject("Microsoft.XMLHTTP"); xmlDocP.onreadystatechange = process; xmlDocL = new ActiveXObject("Microsoft.XMLHTTP"); xmlDocL.onreadystatechange = process; xmlDocN = new ActiveXObject("Microsoft.XMLHTTP"); xmlDocN.onreadystatechange = process; } else { xmlDocA = new XMLHttpRequest(); xmlDocA.onload = process; xmlDocP = new XMLHttpRequest(); xmlDocP.onload = process; xmlDocL = new XMLHttpRequest(); xmlDocL.onload = process; xmlDocN = new XMLHttpRequest(); xmlDocN.onload = process; } xmlDocA.open( "GET", "page/about.html", true ); xmlDocA.send( null ); xmlDocP.open( "GET", "page/photo.html", true ); xmlDocP.send( null ); xmlDocL.open( "GET", "page/lessons.html", true ); xmlDocL.send( null ); xmlDocN.open( "GET", "page/news.html", true ); xmlDocN.send( null ); } function process() { if ( xmlDocA.readyState != 4 && xmlDocP.readyState != 4 && xmlDocL.readyState != 4 && xmlDocN.readyState != 4 ) return; document.getElementById("About").innerHTML = xmlDocA.responseText; document.getElementById("Photo").innerHTML = xmlDocP.responseText; document.getElementById("Lessons").innerHTML = xmlDocL.responseText; document.getElementById("News").innerHTML = xmlDocN.responseText; }
|
Код слишком велик. Возможно ли его как-нибудь укоротить?
Сжатие кода не подойдет! |