function createXMLHttpRequest() {
//表示当前浏览器不是ie,如ns,firefox
if(window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
} else if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
}
function deleteRole(node){
alert(1111);
var row=node.parentNode.parentNode;
//var rowname=row.childNodes[1].innerHTML;
var rowid=row.childNodes[3].innerHTML;
alert("rowid="+rowid);
if(rowid==null){
}else{
createXMLHttpRequest();
//var userId = document.getElementById("userId").value;
// /exam2/deleteRoleAction.action 的我没试; 不知道行不行;
var url = "../../deleteRoleAction.action?roleid=" + rowid + "×tampt=" + new Date().getTime(); xmlHttp.open("GET",url,true); xmlHttp.onreadystatechange=callback; xmlHttp.send(null); } } function callback() { if (xmlHttp.readyState == 4) { if (xmlHttp.status == 200) { alert("ok"); <%-- var resTextSpan = document.getElementById("resText"); --%> <%-- resTextSpan.innerHTML = "<font color='red'>" + --%> <%-- xmlHttp.responseText + "</font>";--%> } } } String.prototype.trim = function() { return this.replace(/^\s\s*/,'').replace(/\s\s*$/,''); } 原文链接:https://www.f2er.com/ajax/165768.html