나는 새 질문을하고있다. 단순화 상황에 내가 의 index.php 파일아약스 코드 사용시 자바 스크립트 사용
<form name="f" action="index.php" method="post">
<input type="button" name="but" id="but" value="Retrieve">
<div id="div"></div>
<input type="submit" name="ok">
</form>
<script type="text/javascript">
document.getElementById("but").onclick = function(){
var http = false;
if (window.XMLHttpRequest){
http = new XMLHttpRequest();
} else {
http = new ActiveXObject("Microsoft.XMLHttp");
}
if (http){
http.open("POST","other.php",true);
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.onreadystatechange = function(){
if (http.status==200 && http.readyState==4){
document.getElementById("div").innerHTML = http.responseText;
}
};
http.send(null);
}
};
document.getElementById("y").onclick = function(){
alert("okaaay");
};
</script>
에서이 스크립트를했습니다 그리고
<?php
echo "<input type='text' name='y' id='y'>";
?>
아약스 스크립트 아래의 스크립트 other.php 파일을 가지고는 좋은 작동하지만 내 문제 이 마크 된 입력 요소가 두 번째 JavaScript 코드로 index.php 페이지에서 검색 될 때 조작 할 수 없다는 것을 알려주세요. :)