그래서 온라인으로 검색해서 다른 작성방법인 setTimeout("fun("parameter ")", 1000)을 사용해 보았는데 여전히 동작하지 않았습니다. 하지만 폼 폼의 텍스트 영역을 전달할 때는 위의 작성 방법으로 괜찮습니다. .
JS에서는 다음과 같이 작성할 수 있습니다.
setTimeout("doAjax(document.sform.txtara.value )", 1000)
그러나 다른 매개변수나 객체 매개변수를 전달하려면 제공된 메소드에 따라 이 함수를 다시 작성해야 합니다. 인터넷에서.
제가 직접 연구하고 개선한 방법이니 참고만 하세요. 다른 상황에 대해서는 보장할 수 없습니다.
코드 복사
코드는 다음과 같습니다.
div class= "main">
코드 복사
코드는 다음과 같습니다.
function initAjax() {
var httprequest=null
try {
httprequest =new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e) {
try {
httprequest=new ActiveXObject("Microsoft.XMLHTTP")
}
catch(e) {
try {
httprequest=new XMLHttpRequest(); } catch(e) {
httprequest=null alert( obj.value) ; var he="he=" msg;
var ajaxrequest=initAjax();
ajaxrequest.open("POST", "abc.jsp", true); "Content-Type" , "application/x-www-form-urlencoded;charset=utf-8");
ajaxrequest.send(he)
ajaxrequest.onreadystatechange=function() {
if (ajaxrequest.readyState= =4) {
if (ajaxrequest.status==200) {
document.getElementById("showpane").innerHTML=ajaxrequest.responseText
}
else {
doAjax( msg );
}
}
}
setTimeout("doAjax(document.sform.txtara.value,document.all[" obj.sourceIndex "])", 100) ;//또한 이 줄
}
이렇게 해서 객체 매개변수 전달 문제를 해결했습니다. 마지막으로 더 나은 해결 방법이 있다면 남겨주세요. 코멘트. 마음이 맞는 분들과 함께 공부하게 되어 기쁩니다!