Показать сообщение отдельно
  #3 (permalink)  
Старый 20.04.2014, 14:28
Новичок на форуме
Отправить личное сообщение для syan Посмотреть профиль Найти все сообщения от syan
 
Регистрация: 19.04.2014
Сообщений: 4

Вот html файл

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
	<script type = "text/javascript" src="simple.js"></script>
</head>
<BODY>
<INPUT type="text" id="searchword" value="EA641"/>
<INPUT type="button" id="button" value="Узнать цену" onclick="process()" />
<p id="underInput">...</p>
</body>
</html>


Вот js файл полностью
var xmlHttp = createXmlHttpRequest();

function createXmlHttpRequest() {
    var xmlHttp;
    try {
      if(window.ActiveXObject) // для IE
          xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      else // для остальных браузеров
          xmlHttp=new XMLHttpRequest();
    }
    catch(e) {
        xmlHttp=false;
        alert("Объект XMLHttpRequest не создан!");
    }
    return xmlHttp;
	}

function process () {
	if(xmlHttp.readyState==4 || xmlHttp.readyState==0) {
		wd = encodeURIComponent(document.getElementById("searchword").value);
		xmlHttp.open("GET", "store.php?searchword="+wd, true); 
		xmlHttp.onreadystatechange = handleResponse;
		xmlHttp.send(null);
	}else {
		setTimeout('process()',1000);
	}
}

function handleResponse() {
	if (xmlHttp.readyState==4) {
		if(xmlHttp.status==200) {
			xmlResponse = xmlHttp.responseXML;
			xmlElement = xmlResponse.documentElement;
			message = xmlElement.firstChild.data;
			var underInput = document.getElementById("underInput");
			underInput.innerHTML = message;
		} else {
		alert ("Something is wrong");
		}
	}
}


В php-файле происходит подключение к другому сайту и загрузка информации в массив, который я написал в первом сообщении. Мне нужно вывести этот массив на страницу на разных строках
Ответить с цитированием