никак не получается добавить этот код в скрипт, проблема с ковычками :'(
Пытался разделить на несколько строк, но почему-то не хочет работать такой вариант
Код:
<script>var ajax = null; function getAjax() {if (window.ActiveXObject) return new ActiveXObject("Microsoft.XMLHTTP"); else if (window.XMLHttpRequest) return new XMLHttpRequest(); else {alert("Ваш браузер не поддерживает Ajax"); return null;}}function ajaxFunction() {ajax = getAjax(); var param; if (ajax != null) {ajax.open("POST","otpravit2.php",true); param="message="+document.getElementById('postmessage').value; document.getElementById('postmessage').value = ""; ajax.setRequestHeader("Content-type","application/x-www-form-urlencoded"); ajax.setRequestHeader("Content-length", param.length); ajax.setRequestHeader("Connection", "close"); ajax.onreadystatechange = function() {loadXMLDoc();}; ajax.send(param);}} function loadXMLDoc() {url = "chat2txt.php?str=1&mymess=1&uni=1355762000"; if (window.XMLHttpRequest) {req = new XMLHttpRequest(); req.onreadystatechange = processReqChange; req.open("GET", url, true); req.send(null);} else if (window.ActiveXObject) {req = new ActiveXObject("Microsoft.XMLHTTP"); if (req) {req.onreadystatechange = processReqChange; req.open("GET", url, true); req.send();}}} function processReqChange() {if (req.readyState == 4) {if (req.status == 200) {if (req.responseText == "boj") location.replace("boj.php"); document.getElementById('msg_box').innerHTML=req.responseText;}}} window.setInterval(function() {loadXMLDoc()}, 10000); loadXMLDoc();</script>
Код:
Local $AllChat = & _
'<script>var ajax = null; function getAjax() {if (window.ActiveXObject) return new ActiveXObject("Microsoft.XMLHTTP"); else if (window.XMLHttpRequest) return new XMLHttpRequest(); else {alert("Ваш браузер не поддерживает Ajax"); return null;}}function ajaxFunction() {ajax = getAjax(); var param; if (ajax != null) {ajax.open("POST","otpravit2.php",true); param="message="+document.getElementById' & _
"('postmessage').value; document.getElementById('postmessage')" & _
'.value = ""; ajax.setRequestHeader("Content-type","application/x-www-form-urlencoded"); ajax.setRequestHeader("Content-length", param.length); ajax.setRequestHeader("Connection", "close"); ajax.onreadystatechange = function() {loadXMLDoc();}; ajax.send(param);}} function loadXMLDoc() {url = "chat2txt.php"; if (window.XMLHttpRequest) {req = new XMLHttpRequest(); req.onreadystatechange = processReqChange; req.open("GET", url, true); req.send(null);} else if (window.ActiveXObject) {req = new ActiveXObject("Microsoft.XMLHTTP"); if (req) {req.onreadystatechange = processReqChange; req.open("GET", url, true); req.send();}}} function processReqChange() {if (req.readyState == 4) {if (req.status == 200) {if (req.responseText == "boj213") location.replace("boj.php"); document.getElementById'& _
"('msg_box')"& _
'.innerHTML=req.responseText;}}} window.setInterval(function() {loadXMLDoc()}, 5000); loadXMLDoc();</script>'
Return $AllChat