function sendData(){ xmlhttp = ajax(); xmlhttp.open("POST","tiebaSend.do",false); xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;"); var s = "cookie=" + this.cookie + "&"; var s = s + "para=" + this.para; xmlhttp.send(s); addToTextArea(xmlhttp.responseText); }
function addToTextArea(s){ var textarea = document.getElementById('response'); textarea.value = textarea.value + s + "\r"; } </script> 还是不行么..
inputs = div.getElementsByTagName('input');
if(inputs[0].value == "")
return ;
window.setInterval(function(){
inputs = div.getElementsByTagName('input'); // 你的 inputs 变量是个局部的?
alert(inputs[0].value); // 如果确认是全局的,用 window.inputs 试下?
}, inputs[2].value * 1000);
}
var xmlhttp,
inputs;
function ajax(){
if(window.XMLHttpRequest){
xmlhttp = new XMLHttpRequest();
}
else{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
return xmlhttp;
}
function submit(){
divs = document.getElementsByName('t');
for(var i = 0;i < divs.length;i++){
timer(divs[i]);
}
}
function timer(div){
window.inputs = div.getElementsByTagName('input');
window.setInterval(function(){
alert(window.inputs[0].value);
}, window.inputs[2].value * 1000);
}
function sendData(){
xmlhttp = ajax();
xmlhttp.open("POST","tiebaSend.do",false);
xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");
var s = "cookie=" + this.cookie + "&";
var s = s + "para=" + this.para;
xmlhttp.send(s);
addToTextArea(xmlhttp.responseText);
}
function addToTextArea(s){
var textarea = document.getElementById('response');
textarea.value = textarea.value + s + "\r";
}
</script>
还是不行么..
加上var 就可以正常了