這是我的JavaScript的Javascript獲得由ID元素和他的內在價值
function xmlhttpPost(strURL,formname,responsediv,responsemsg) {
var xmlHttpReq = false;
var self = this;
// Xhr per Mozilla/Safari/Ie7
if (window.XMLHttpRequest) {
self.xmlHttpReq = new XMLHttpRequest();
}
// per tutte le altre versioni di IE
else if (window.ActiveXObject) {
self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
}
self.xmlHttpReq.open('POST', strURL, true);
self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
self.xmlHttpReq.onreadystatechange = function() {
if (self.xmlHttpReq.readyState == 4) {
// Quando pronta, visualizzo la risposta del form
updatepage(self.xmlHttpReq.responseText,responsediv);
}
else{
// In attesa della risposta del form visualizzo il msg di attesa
updatepage(responsemsg,responsediv);
}
}
self.xmlHttpReq.send(getquerystring(formname));
}
function getquerystring(formname) {
var qstr = document.getElementById[formname];
return qstr;
}
function updatepage(str,responsediv){
document.getElementById(responsediv).innerHTML = str;
}
首先,它是deveoped表單裏面的值,且易我可以在另一個PHP文件傳輸提交值,並進行查詢,現在我想修改它只是簡單地在新文件中傳遞一個元素的某個值,即將在另一個元素中加載ajax並執行查詢,在哪裏出錯了,以及如何在另一個文件中回顯此類中的值?
當你通過'formname'時,它是'
是Formname,但我已修改表單函數返回值OD ID和獲得ID,現在我不知道如何回聲該值 – 2013-04-10 20:50:18