| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2898 人关注过本帖
标题:Component returned failure code: 0x80040111,firefox中报错
只看楼主 加入收藏
varhome
Rank: 2
等 级:论坛游民
帖 子:10
专家分:20
注 册:2008-7-23
结帖率:100%
收藏
 问题点数:0 回复次数:0 
Component returned failure code: 0x80040111,firefox中报错
ajax在firefox中报错,找不到原因,请高手指点
错误提示:
uncaught exception: [Exception... "Component returned failure code: 0xc1f30001 (NS_ERROR_NOT_INITIALIZED) [nsIXMLHttpRequest.send]" nsresult: "0xc1f30001 (NS_ERROR_NOT_INITIALIZED)" location: "JS frame :: javascript: eval(__firebugTemp__); :: anonymous :: line 1" data: no]
[Break on this error] undefined
[Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.status]" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: http://localhost:8080/shanliao/js/im.js :: processChat :: line 525" data: no]
[Break on this error] if (xmlHttp.status == 200) {

我的代码:

var txtNode;
var headChatTbody;
var headText;
var headText;
var openButton;
var closeButton;
var headBeforeText;
var bodyChatTable;
var bodyChatTbody;
var bodyRow;
var bodyChatCell;
var bodyChatTitleOutersideTable;
var bodyChatTitleOutersideTbody;
var bodyChatTitleOutersideRow;
var bodyChatTitleOutersideCell;
var bodyChatTitleInnersideTable;
var bodyChatTitleInnersideTbody;
var bodyChatTitleInnersideRow;
var bodyChatTitleInnersideCell;
var sendToPrivateUserRadio;
var bodyChatUserListDiv;
var bodyChatDisplayContentDiv;
var currentuserId;
var bodyChatTitleCurrentuserText;
var bodyChatContentChangeRightCell1;
var bodyChatBigContentTable;
var bodyChatContentUserListCell1;
var bodyChatRightButtonImg;
var bodyChatLeftButtonImg;
var bodyChatBigContentCell;
var bodyChatSendContentInputText;
var headCountText;
var currentCountText;
var current_user_name;
var set_time_out_Object;
var ajax_basic_url = "./chatajax.jsp";
var basic_url = "./images/chat/";
var init_top;
var init_left;
var flush_time;
var xmlHttp;
window.onload = function () {

    var bodyObject = getBodyObj();
    init_top = bodyObject.clientHeight;
    init_left = bodyObject.clientWidth;
    set_time_out_Object = setTimeout("initchat()", 5000);
};
window.onunload = function () {
    clearTimeout(set_time_out_Object);
};
window.onscroll = function () {
    setTimeout("scrollTo()", 100);
};


//get broser type
function KindGetBrowser() {
    var browser = "";
    var agentInfo = navigator.userAgent.toLowerCase();
    if (agentInfo.indexOf("msie") > -1) {
        var re = new RegExp("msie\\s?([\\d\\.]+)", "ig");
        var arr = re.exec(agentInfo);
        if (parseInt(RegExp.$1) >= 5.5) {
            browser = "IE";
        }
    } else {
        if (agentInfo.indexOf("firefox") > -1) {
            browser = "FF";
        }
    }
    return browser;
}

//init chat widget
function initchat() {
    var bodyObject = getBodyObj();
    bodyObject.scrollTop = "0px";
    bodyObject.scrollLeft = "0px";
    
    //create div(iframeDiv) , IE6 div and select
    var iframeDiv = document.createElement("div");
    iframeDiv.id = "iframeDiv";
    document.body.appendChild(iframeDiv);
    iframeDiv.style.position = "absolute";
    iframeDiv.style.left = parseInt(init_left, 10) - 210 + "px";
    iframeDiv.style.top = parseInt(init_top, 10) - 31 + "px";
    
    //create iframe
    var iframeObject = document.createElement("iframe");
    iframeObject.id = "iframeObject";
    iframeObject.height = "31px";
    iframeObject.width = "200px";
    iframeDiv.appendChild(iframeObject);
    
    //create totalChatDiv
    totalChatDiv = document.createElement("div");
    totalChatDiv.id = "totalChatDiv";
    document.body.appendChild(totalChatDiv);
    
    //create table(totalChatTable)
    totalChatTable = document.createElement("table");
    totalChatTable.setAttribute("id", "totalChatTable");
    totalChatTable.setAttribute("width", "201px");
    totalChatTable.setAttribute("height", "31px");
    totalChatTable.setAttribute("border", "1px");
    totalChatTable.setAttribute("borderColor", "#12387A");
    totalChatTable.setAttribute("align", "center");
    totalChatTable.setAttribute("cellPadding", "0px");
    totalChatTable.setAttribute("cellSpacing", "0px");
    totalChatTable.style.position = "absolute";
    totalChatTable.style.left = parseInt(init_left, 10) - 210 + "px";
    totalChatTable.style.top = parseInt(init_top, 10) - 31 + "px";
    totalChatTable.style.zIndex = 2147483647;
    totalChatTable.style.margin = 0;
    totalChatDiv.appendChild(totalChatTable);
    totalChatTbody = document.createElement("tbody");
    totalChatTbody.setAttribute("id", "totalChatTbody");
    totalChatTable.appendChild(totalChatTbody);
    totalRow = document.createElement("tr");
    totalRow.setAttribute("id", "totalRow");
    totalChatTbody.appendChild(totalRow);
    totalCell = document.createElement("td");
    totalCell.setAttribute("id", "totalCell");
    totalCell.setAttribute("valign", "top");
    totalRow.appendChild(totalCell);
    createChatHead();  // create chat widget header
    createChatBody();  // create chat widget body
    //chatLocation();        
    initData();        // init chat data
}

//create chat head
function createChatHead() {
    headChatTable = document.createElement("table");
    headChatTable.setAttribute("id", "headChatTable");
    headChatTable.setAttribute("width", "201px");
    headChatTable.setAttribute("height", "31px");
    headChatTable.setAttribute("border", "0px");
    headChatTable.setAttribute("cellPadding", "0px");
    headChatTable.setAttribute("cellSpacing", "0px");
    document.getElementById("totalCell").appendChild(headChatTable);
    headChatTbody = document.createElement("tbody");
    headChatTbody.setAttribute("id", "headChatTbody");
    headChatTable.appendChild(headChatTbody);
    headChatRow = document.createElement("tr");
    headChatRow.setAttribute("id", "headChatRow");
    headChatTbody.appendChild(headChatRow);
    headChatCell = document.createElement("td");
    headChatCell.setAttribute("id", "headChatCell");
    headChatCell.setAttribute("background", basic_url + "chat_head.gif");
    headChatCell.setAttribute("width", "201px");
    headChatRow.appendChild(headChatCell);
    headChatContentTable = document.createElement("table");
    headChatContentTable.setAttribute("id", "headChatContentTable");
    headChatContentTable.setAttribute("width", "201px");
    headChatContentTable.setAttribute("height", "31px");
    headChatContentTable.setAttribute("border", "0px");
    headChatContentTable.setAttribute("cellPadding", "0px");
    headChatContentTable.setAttribute("cellSpacing", "0px");
    headChatCell.appendChild(headChatContentTable);
    headChatContentTbody = document.createElement("tbody");
    headChatContentTbody.setAttribute("id", "headChatContentTbody");
    headChatContentTable.appendChild(headChatContentTbody);
    headContentRow = document.createElement("tr");
    headContentRow.setAttribute("id", "headContentRow");
    headChatContentTbody.appendChild(headContentRow);
    headChatContentSpanCell = document.createElement("td");
    headChatContentSpanCell.setAttribute("id", "headChatContentSpanCell");
    headChatContentSpanCell.setAttribute("width", "40px");
    headContentRow.appendChild(headChatContentSpanCell);
    headChatContentCountUserCell = document.createElement("td");
    headChatContentCountUserCell.setAttribute("id", "headChatContentCountUserCell");
    headChatContentCountUserCell.setAttribute("width", "126px");
    headChatContentCountUserCell.style.color = "#F4F7FA";
    headChatContentCountUserCell.style.fontWeight = "bold";
    headChatContentCountUserCell.style.fontSize = "12px";
    headContentRow.appendChild(headChatContentCountUserCell);
    headBeforeText = document.createTextNode("\u70b9\u51fb\u6253\u5f00\u804a\u5929(");
    headChatContentCountUserCell.appendChild(headBeforeText);
    headCountText = document.createTextNode("0");
    headChatContentCountUserCell.appendChild(headCountText);
    headAfterText = document.createTextNode("\u4eba)");
    headChatContentCountUserCell.appendChild(headAfterText);
    headChatContentDispalyButtonCell = document.createElement("td");
    headChatContentDispalyButtonCell.setAttribute("id", "headChatContentDispalyButtonCell");
    headChatContentDispalyButtonCell.setAttribute("align", "center");
    headContentRow.appendChild(headChatContentDispalyButtonCell);
    openButton = document.createElement("img");
    openButton.setAttribute("id", "openButton");
    openButton.setAttribute("src", basic_url + "max.gif");
    openButton.onclick = openChat;
    headChatContentDispalyButtonCell.appendChild(openButton);
    closeButton = document.createElement("img");
    openButton.setAttribute("id", "colseButton");
    closeButton.setAttribute("src", basic_url + "min.gif");
    closeButton.style.display = "none";
    closeButton.onclick = closeChat;
    headChatContentDispalyButtonCell.appendChild(closeButton);
}
function createChatBody() {
    bodyChatTable = document.createElement("table");
    bodyChatTable.setAttribute("id", "bodyChatTable");
    bodyChatTable.setAttribute("width", "100%");
    bodyChatTable.setAttribute("border", "0px");
    bodyChatTable.setAttribute("cellPadding", "0px");
    bodyChatTable.setAttribute("cellSpacing", "0px");
    bodyChatTable.style.background = "#ffffff";
    bodyChatTable.style.display = "none";
    document.getElementById("totalCell").appendChild(bodyChatTable);
    bodyChatTbody = document.createElement("tbody");
    bodyChatTbody.setAttribute("id", "bodyChatTbody");
    bodyChatTable.appendChild(bodyChatTbody);
    bodyChatRow = document.createElement("tr");
    bodyChatRow.setAttribute("id", "bodyChatRow");
    bodyChatTbody.appendChild(bodyChatRow);
    bodyChatCell = document.createElement("td");
    bodyChatCell.setAttribute("id", "bodyChatCell");
    bodyChatRow.appendChild(bodyChatCell);
    createBodyChatTitle();
    createBodyChatBigContent();
    createBodyChatSendContent();
}


//create bodyChatTitle
function createBodyChatTitle() {
    bodyChatTitleOutersideTable = document.createElement("table");
    bodyChatTitleOutersideTable.setAttribute("id", "bodyChatTitleOutersideTable");
    bodyChatTitleOutersideTable.setAttribute("width", "199px");
    bodyChatTitleOutersideTable.setAttribute("height", "25px");
    bodyChatTitleOutersideTable.setAttribute("border", "0px");
    bodyChatTitleOutersideTable.setAttribute("cellPadding", "0px");
    bodyChatTitleOutersideTable.setAttribute("cellSpacing", "0px");
    document.getElementById("bodyChatCell").appendChild(bodyChatTitleOutersideTable);
    bodyChatTitleOutersideTbody = document.createElement("tbody");
    bodyChatTitleOutersideTbody.setAttribute("id", "bodyChatTitleOutersideTbody");
    bodyChatTitleOutersideTable.appendChild(bodyChatTitleOutersideTbody);
    bodyChatTitleOutersideRow = document.createElement("tr");
    bodyChatTitleOutersideRow.setAttribute("id", "bodyChatTitleOutersideRow");
    bodyChatTitleOutersideTbody.appendChild(bodyChatTitleOutersideRow);
    bodyChatTitleOutersideCell = document.createElement("td");
    bodyChatTitleOutersideCell.setAttribute("id", "bodyChatTitleOutersideCell");
    bodyChatTitleOutersideCell.setAttribute("background", basic_url + "chat_head2.gif");
    bodyChatTitleOutersideRow.appendChild(bodyChatTitleOutersideCell);
    bodyChatTitleInnersideTable = document.createElement("table");
    bodyChatTitleInnersideTable.setAttribute("id", "bodyChatTitleInnersideTable");
    bodyChatTitleInnersideTable.setAttribute("width", "100%");
    bodyChatTitleInnersideTable.setAttribute("align", "center");
    bodyChatTitleInnersideTable.setAttribute("border", "0px");
    bodyChatTitleInnersideTable.setAttribute("cellPadding", "0px");
    bodyChatTitleInnersideTable.setAttribute("cellSpacing", "0px");
    bodyChatTitleOutersideCell.appendChild(bodyChatTitleInnersideTable);
    bodyChatTitleInnersideTbody = document.createElement("tbody");
    bodyChatTitleInnersideTbody.setAttribute("id", "bodyChatTitleInnersideTbody");
    bodyChatTitleInnersideTable.appendChild(bodyChatTitleInnersideTbody);
    bodyChatTitleInnersideRow = document.createElement("tr");
    bodyChatTitleInnersideRow.setAttribute("id", "bodyChatTitleInnersideRow");
    bodyChatTitleInnersideTbody.appendChild(bodyChatTitleInnersideRow);
    bodyChatTitleInnersideCell = document.createElement("td");
    bodyChatTitleInnersideCell.setAttribute("id", "bodyChatTitleInnersideCell");
    bodyChatTitleInnersideCell.setAttribute("colspan", "2");
    bodyChatTitleInnersideCell.style.paddingLeft = "30px";
    bodyChatTitleInnersideCell.style.paddingTop = "3px";
    bodyChatTitleInnersideCell.style.color = "#000000";
    bodyChatTitleInnersideCell.style.fontSize = "12px";
    bodyChatTitleInnersideRow.appendChild(bodyChatTitleInnersideCell);
    bodyChatTitleCurrentuserText = document.createTextNode("guest");
    bodyChatTitleInnersideCell.appendChild(bodyChatTitleCurrentuserText);
}
function createBodyChatBigContent() {
    bodyChatBigContentTable = document.createElement("table");
    bodyChatBigContentTable.setAttribute("id", "bodyChatBigContentTable");
    bodyChatBigContentTable.setAttribute("width", "195px");
    bodyChatBigContentTable.setAttribute("height", "233px");
    bodyChatBigContentTable.setAttribute("border", "0px");
    bodyChatBigContentTable.setAttribute("align", "center");
    bodyChatBigContentTable.setAttribute("cellPadding", "0px");
    bodyChatBigContentTable.setAttribute("cellSpacing", "0px");
    document.getElementById("bodyChatCell").appendChild(bodyChatBigContentTable);
    bodyChatBigContentTbody = document.createElement("tbody");
    bodyChatBigContentTbody.setAttribute("id", "bodyChatBigContentTbody");
    bodyChatBigContentTable.appendChild(bodyChatBigContentTbody);
    bodyChatBigContentRow = document.createElement("tr");
    bodyChatBigContentRow.setAttribute("id", "bodyChatBigContentRow");
    bodyChatBigContentTbody.appendChild(bodyChatBigContentRow);
    bodyChatBigContentCell = document.createElement("td");
    bodyChatBigContentCell.setAttribute("id", "bodyChatBigContentCell");
    bodyChatBigContentCell.setAttribute("bgcolor", "#FFFFFF");
    bodyChatBigContentCell.setAttribute("width", "187px");
    bodyChatBigContentRow.appendChild(bodyChatBigContentCell);
    bodyChatDisplayContentDiv = document.createElement("div");
    bodyChatDisplayContentDiv.setAttribute("id", "bodyChatDisplayContentDiv");
    bodyChatDisplayContentDiv.style.height = "230px";
    bodyChatDisplayContentDiv.style.width = "180px";
    bodyChatDisplayContentDiv.style.overflowY = "auto";
    bodyChatDisplayContentDiv.style.overflowX = "auto";
    bodyChatDisplayContentDiv.style.fontSize = "12px";
    bodyChatBigContentCell.appendChild(bodyChatDisplayContentDiv);
    bodyChatContentChangeRightCell1 = document.createElement("td");
    bodyChatContentChangeRightCell1.setAttribute("id", "bodyChatContentChangeRightCell1");
    bodyChatBigContentRow.appendChild(bodyChatContentChangeRightCell1);
    bodyChatContentUserListCell1 = document.createElement("td");
    bodyChatContentUserListCell1.setAttribute("id", "bodyChatContentUserListCell1");
    bodyChatContentUserListCell1.setAttribute("valign", "top");
    bodyChatContentUserListCell1.style.display = "none";
    bodyChatBigContentRow.appendChild(bodyChatContentUserListCell1);
    bodyChatUserCountDiv = document.createElement("div");
    bodyChatUserCountDiv.setAttribute("id", "bodyChatUserCountDiv");
    bodyChatUserCountDiv.style.height = "20px";
    bodyChatUserCountDiv.style.paddingLeft = "10px";
    bodyChatUserCountDiv.style.paddingTop = "2px";
    bodyChatUserCountDiv.style.fontSize = "12px";
    bodyChatUserCountDiv.style.color = "#FF7700";
    bodyChatContentUserListCell1.appendChild(bodyChatUserCountDiv);
    currentCountText = document.createTextNode("0");
    bodyChatUserCountDiv.appendChild(currentCountText);
    bodyChatUserCountDiv.appendChild(document.createTextNode("\u7528\u6237"));
    createChangeRightButton();
    createBodyChatUserList();
}

//create user list
function createBodyChatUserList() {
    bodyChatUserListDiv = document.createElement("div");
    bodyChatUserListDiv.setAttribute("id", "bodyChatUserListDiv");
    bodyChatUserListDiv.style.height = "210px";
    bodyChatUserListDiv.style.overflowY = "auto";
    bodyChatUserListDiv.style.width = "93px";
    bodyChatUserListDiv.style.overflowX = "auto";
    bodyChatUserListDiv.style.fontSize = "12px";
    bodyChatContentUserListCell1.appendChild(bodyChatUserListDiv);
}
function createChangeRightButton() {
    bodyChatContentChangeRightCell1.setAttribute("width", "8px");
    bodyChatContentChangeRightCell1.setAttribute("height", "40px");
    bodyChatContentChangeRightCell1.setAttribute("background", basic_url + "chat_middlel.gif");
    bodyChatRightButtonImg = document.createElement("img");
    bodyChatRightButtonImg.setAttribute("id", "bodyChatRightButtonImg");
    bodyChatRightButtonImg.setAttribute("src", basic_url + "chat_arrow2.gif");
    bodyChatRightButtonImg.setAttribute("width", "8px");
    bodyChatRightButtonImg.setAttribute("height", "40px");
    bodyChatRightButtonImg.style.display = "";
    bodyChatRightButtonImg.onclick = toLeft;
    bodyChatContentChangeRightCell1.appendChild(bodyChatRightButtonImg);
    bodyChatLeftButtonImg = document.createElement("img");
    bodyChatLeftButtonImg.setAttribute("id", "bodyChatLeftButtonImg");
    bodyChatLeftButtonImg.setAttribute("src", basic_url + "chat_arrow.gif");
    bodyChatLeftButtonImg.setAttribute("width", "8px");
    bodyChatLeftButtonImg.setAttribute("height", "40px");
    bodyChatLeftButtonImg.style.display = "none";
    bodyChatLeftButtonImg.onclick = toRight;
    bodyChatContentChangeRightCell1.appendChild(bodyChatLeftButtonImg);
}
function createBodyChatSendContent() {
    bodyChatSendContentTable = document.createElement("table");
    bodyChatSendContentTable.setAttribute("id", "bodyChatSendContentTable");
    bodyChatSendContentTable.setAttribute("width", "191px");
    bodyChatSendContentTable.setAttribute("border", "0px");
    bodyChatSendContentTable.setAttribute("align", "center");
    bodyChatSendContentTable.setAttribute("cellPadding", "0px");
    bodyChatSendContentTable.setAttribute("cellSpacing", "0px");
    document.getElementById("bodyChatCell").appendChild(bodyChatSendContentTable);
    bodyChatSendContentTbody = document.createElement("tbody");
    bodyChatSendContentTbody.setAttribute("id", "bodyChatSendContentTbody");
    bodyChatSendContentTable.appendChild(bodyChatSendContentTbody);
    bodyChatSendToRow = document.createElement("tr");
    bodyChatSendToRow.setAttribute("id", "bodyChatSendToRow");
    bodyChatSendContentTbody.appendChild(bodyChatSendToRow);
    bodyChatSendToCell = document.createElement("td");
    bodyChatSendToCell.setAttribute("id", "bodyChatSendToCell");
    bodyChatSendToCell.setAttribute("height", "25px");
    bodyChatSendToCell.style.fontSize = "12px";
    bodyChatSendToRow.appendChild(bodyChatSendToCell);
    bodyChatSendToCell.appendChild(document.createTextNode("\u5bf9"));
    sendToUserSelect = document.createElement("select");
    sendToUserSelect.setAttribute("name", "sendToUserSelect");
    sendToUserSelect.setAttribute("id", "sendToUserSelect");
    sendToUserSelect.style.width = "80px";
    sendToUserSelect.style.fontSize = "12px";
    bodyChatSendToCell.appendChild(sendToUserSelect);
    sendToUserSelect.options.add(new Option("\u6240\u6709\u4eba", "0"));
    bodyChatSendToCell.appendChild(document.createTextNode("\u79c1\u804a"));
    sendToPrivateUserRadio = document.createElement("input");
    sendToPrivateUserRadio.setAttribute("id", "sendToPrivateUserRadio");
    sendToPrivateUserRadio.setAttribute("type", "checkBox");
    sendToPrivateUserRadio.setAttribute("name", "sendToPrivateUserRadio");
    sendToPrivateUserRadio.setAttribute("value", "privateChat");
    bodyChatSendToCell.appendChild(sendToPrivateUserRadio);
    bodyChatSendContentRow = document.createElement("tr");
    bodyChatSendContentRow.setAttribute("id", "bodyChatSendContentRow");
    bodyChatSendContentTbody.appendChild(bodyChatSendContentRow);
    bodyChatSendContentInputCell = document.createElement("td");
    bodyChatSendContentInputCell.setAttribute("id", "bodyChatSendContentInputCell");
    bodyChatSendContentInputCell.setAttribute("height", "25px");
    bodyChatSendContentRow.appendChild(bodyChatSendContentInputCell);
    bodyChatSendContentInputText = document.createElement("input");
    bodyChatSendContentInputText.setAttribute("id", "bodyChatSendContentInputText");
    bodyChatSendContentInputText.setAttribute("type", "text");
    bodyChatSendContentInputText.setAttribute("size", "20px");
    bodyChatSendContentInputText.setAttribute("name", "bodyChatSendContentInputText");
    bodyChatSendContentInputText.setAttribute("id", "bodyChatSendContentInputText");
    bodyChatSendContentInputText.setAttribute("border", "1px");
    bodyChatSendContentInputText.style.borderColor = "#cccccc";
    bodyChatSendContentInputText.style.paddingTop = "2px";
    bodyChatSendContentInputText.style.color = "#000000";
    bodyChatSendContentInputCell.appendChild(bodyChatSendContentInputText);
    bodyChatSendContentButtonCell = document.createElement("td");
    bodyChatSendContentButtonCell.setAttribute("id", "bodyChatSendContentButtonCell");
    bodyChatSendContentButtonCell.setAttribute("align", "right");
    bodyChatSendContentRow.appendChild(bodyChatSendContentButtonCell);
    bodyChatSendContentInputImg = document.createElement("img");
    bodyChatSendContentInputImg.setAttribute("src", basic_url + "chat_send.gif");
    bodyChatSendContentInputImg.setAttribute("width", "26px");
    bodyChatSendContentInputImg.setAttribute("height", "22px");
    bodyChatSendContentInputImg.onclick = sendNewPost;
    bodyChatSendContentButtonCell.appendChild(bodyChatSendContentInputImg);
}

//open chat widget
function openChat() {
    openButton.style.display = "none";
    closeButton.style.display = "";
    headBeforeText.data = "\u5f53\u524d\u5728\u7ebf(";
    bodyChatTable.style.display = "";
    var totalChatTableObject = document.getElementById("totalChatTable");
    var iframeDivObject1 = document.getElementById("iframeDiv");
    var bodyObject = getBodyObj();
        
    totalChatTableObject.style.top = parseInt(init_top, 10) + parseInt(bodyObject.scrollTop, 10) - parseInt(totalChatTableObject.offsetHeight, 10) + "px";
    totalChatTableObject.style.left = parseInt(init_left, 10) + parseInt(bodyObject.scrollLeft, 10) - parseInt(totalChatTableObject.offsetWidth, 10) + "px";
    iframeDivObject1.style.top = parseInt(init_top, 10) + parseInt(bodyObject.scrollTop, 10) - parseInt(totalChatTableObject.offsetHeight, 10) + "px";
    iframeDivObject1.style.left = parseInt(init_left, 10) + parseInt(bodyObject.scrollLeft, 10) - parseInt(totalChatTableObject.offsetWidth, 10) + "px";
    iframeDivObject1.height = parseInt(totalChatTableObject.offsetHeight, 10) + "px";
}


//close chat widget
function closeChat() {
    closeButton.style.display = "none";
    openButton.style.display = "";
    headBeforeText.data = "\u70b9\u51fb\u6253\u5f00\u804a\u5929(";
    bodyChatTable.style.display = "none";
    var totalChatTableObject = document.getElementById("totalChatTable");
    var iframeDivObject1 = document.getElementById("iframeDiv");
    var bodyObject = getBodyObj();
        
    totalChatTableObject.style.top = parseInt(init_top, 10) + parseInt(bodyObject.scrollTop, 10) - parseInt(totalChatTableObject.offsetHeight, 10) + "px";
    totalChatTableObject.style.left = parseInt(init_left, 10) + parseInt(bodyObject.scrollLeft, 10) - parseInt(totalChatTableObject.offsetWidth, 10) + "px";
    iframeDivObject1.style.top = parseInt(init_top, 10) + parseInt(bodyObject.scrollTop, 10) - parseInt(totalChatTableObject.offsetHeight, 10) + "px";
    iframeDivObject1.style.left = parseInt(init_left, 10) + parseInt(bodyObject.scrollLeft, 10) - parseInt(totalChatTableObject.offsetWidth, 10) + "px";
    iframeDivObject1.height = parseInt(totalChatTableObject.offsetHeight, 10) + "px";
}
function toLeft() {
    bodyChatRightButtonImg.style.display = "none";
    bodyChatLeftButtonImg.style.display = "";
    bodyChatDisplayContentDiv.style.width = "90px";
    bodyChatBigContentCell.setAttribute("width", "90px");
    bodyChatContentUserListCell1.style.display = "";
}
function toRight() {
    bodyChatRightButtonImg.style.display = "";
    bodyChatLeftButtonImg.style.display = "none";
    bodyChatContentUserListCell1.setAttribute("avlign" , "top");
    bodyChatDisplayContentDiv.style.width = "180px";
    bodyChatBigContentCell.setAttribute("width", "187px");
    bodyChatContentUserListCell1.style.display = "none";
}
function createXMLHttpRequest() {
    if (window.ActiveXObject) {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    } else {
        if (window.XMLHttpRequest) {
            xmlHttp = new XMLHttpRequest();
        }
    }
}
function initData() {
    createXMLHttpRequest();
    var current_user_name = getApplicationUser();
    var ajax_url = ajax_basic_url + "?opertype=initdata&currentUserName=" + current_user_name;
    ajax_url = encodeURI(ajax_url);
    ajax_url = encodeURI(ajax_url);
    xmlHttp.open("POST", ajax_url, true);
    xmlHttp.onreadystatechange = processChat;
    xmlHttp.send(null);
}
function flushData() {
    var current_user_name = getApplicationUser();
    var ajax_url = ajax_basic_url + "?opertype=flushdata&currentuserId=" + currentuserId + "&currentUserName=" + current_user_name;
    ajax_url = encodeURI(ajax_url);
    ajax_url = encodeURI(ajax_url);
    xmlHttp.open("POST", ajax_url, true);
    xmlHttp.onreadystatechange = processChat;
    xmlHttp.send(null);
}
function sendNewPost() {
    var chat_msg_from_nickname = bodyChatTitleCurrentuserText.data;
    var chat_msg_value = document.getElementById("bodyChatSendContentInputText").value;
    var chat_msg_to_optionIndex = document.getElementById("sendToUserSelect").value;
    var chat_msg_to_nickname = document.getElementById("sendToUserSelect").options[document.getElementById("sendToUserSelect").selectedIndex].text;
    var chat_msg_isprivate = sendToPrivateUserRadio.checked;
    if (chat_msg_value.replace(/(^\s*|\s*$)/g, "") < 1) {
        alert("\u5185\u5bb9\u4e0d\u80fd\u4e3a\u7a7a");
    } else {
        if (true == chat_msg_isprivate && "0" == chat_msg_to_optionIndex) {
            alert("\u8bf7\u9009\u62e9\u79c1\u804a\u5bf9\u8c61");
        } else {
            createXMLHttpRequest();
            var ajax_url = ajax_basic_url + "?opertype=sendnewpost&chat_msg_from_nickname=" + chat_msg_from_nickname + "&chat_msg_to_optionIndex=" + chat_msg_to_optionIndex + "&chat_msg_value=" + chat_msg_value + "&chat_msg_to_nickname=" + chat_msg_to_nickname + "&chat_msg_isprivate=" + chat_msg_isprivate;
            ajax_url = encodeURI(ajax_url);
            ajax_url = encodeURI(ajax_url);
            document.getElementById("bodyChatSendContentInputText").value = "";
            xmlHttp.open("POST", ajax_url, true);
            xmlHttp.onreadystatechange = processChat;
            xmlHttp.send(null);
        }
    }
}
var xml;
var docNodes;
function processChat() {
    if (xmlHttp.readyState == 4) {
        if (xmlHttp.status == 200) {
            xml = xmlHttp.responseXML;
            try {
                updateCurrentUser(xml);
                updateOnlineCounter(xml);
                updataOnlineList(xml);
                updateChatMsg(xml);
                flush_time = xml.getElementsByTagName("flushtime").item(0).firstChild.nodeValue;
                set_time_out_Object = setTimeout("flushData()", eval(flush_time));
            }
            catch (e) {
            }
        }
    }
}
function updateCurrentUser(xml) {
    currentuserId = xml.getElementsByTagName("userid").item(0).firstChild.nodeValue;
    bodyChatTitleCurrentuserText.data = xml.getElementsByTagName("nickname").item(0).firstChild.nodeValue;
}
function updateOnlineCounter(xml) {
    headCountText.data = xml.getElementsByTagName("chatonlinecounter").item(0).firstChild.nodeValue;
    currentCountText.data = headCountText.data;
}
function updataOnlineList(xml) {
    var onlineidNodeList = xml.getElementsByTagName("onlineid");
    var onlinenicknameNodeList = xml.getElementsByTagName("onlinenickname");
    var onlineNewSpan = null;
    var onlineNewAhref = null;
    var exist_online_list_size = bodyChatUserListDiv.childNodes.length;
    for (size = exist_online_list_size; size > 0; size--) {
        bodyChatUserListDiv.removeChild(bodyChatUserListDiv.childNodes[size - 1]);
    }
    for (var index = 0; index < onlineidNodeList.length; index++) {
        onlineNewSpan = document.createElement("div");
        onlineNewSpan.style.paddingLeft = "5px";
        onlineNewSpan.style.height = "15px";
        onlineNewSpan.style.fontSize = "12px";
        bodyChatUserListDiv.appendChild(onlineNewSpan);
        onlineNewAhref = document.createElement("a");
        onlineNewAhref.style.textDecoration = "none";
        onlineNewAhref.setAttribute("href", "javascript:privateChatToOnline('" + onlineidNodeList.item(index).firstChild.nodeValue + "','" + onlinenicknameNodeList.item(index).firstChild.nodeValue + "')");
        onlineNewSpan.appendChild(onlineNewAhref);
        onlineNewAhref.appendChild(document.createTextNode(onlinenicknameNodeList.item(index).firstChild.nodeValue));
    }
}
function updateChatMsg(xml) {
    var isprivateList = xml.getElementsByTagName("isprivate");
    var sendfromnicknameList = xml.getElementsByTagName("sendfromnickname");
    var sendtoidList = xml.getElementsByTagName("sendtoid");
    var sendtonicknameList = xml.getElementsByTagName("sendtonickname");
    var chatmsgList = xml.getElementsByTagName("chatmsg");
    var chatmsgnicknamediv;
    var chatmsgcontentdiv;
    var exist_msg_list_size = bodyChatDisplayContentDiv.childNodes.length;
    for (size = exist_msg_list_size; size > 0; size--) {
        bodyChatDisplayContentDiv.removeChild(bodyChatDisplayContentDiv.childNodes[size - 1]);
    }
    for (var index = 0; index < sendfromnicknameList.length; index++) {
        chatmsgnicknamediv = document.createElement("div");
        chatmsgnicknamediv.style.color = "red";
        chatmsgcontentdiv = document.createElement("div");
        chatmsgcontentdiv.style.paddingLeft = "5px";
        bodyChatDisplayContentDiv.appendChild(chatmsgnicknamediv);
        bodyChatDisplayContentDiv.appendChild(chatmsgcontentdiv);
        if ("1" == isprivateList.item(index).firstChild.nodeValue) {
            chatmsgnicknamediv.appendChild(document.createTextNode("\u3010\u79c1\u804a\u3011"));
        }
        chatmsgnicknamediv.appendChild(document.createTextNode(sendfromnicknameList.item(index).firstChild.nodeValue));
        if ("0" != sendtoidList.item(index).firstChild.nodeValue) {
            chatmsgnicknamediv.appendChild(document.createTextNode("\u5bf9"));
            chatmsgnicknamediv.appendChild(document.createTextNode(sendtonicknameList.item(index).firstChild.nodeValue));
        }
        chatmsgnicknamediv.appendChild(document.createTextNode("\u8bf4\uff1a"));
        chatmsgcontentdiv.appendChild(document.createTextNode(chatmsgList.item(index).firstChild.nodeValue));
    }
    bodyChatDisplayContentDiv.scrollTop += bodyChatDisplayContentDiv.clientHeight;
}
function privateChatToOnline(toOnlineId, toOnlineNickname) {
    if (bodyChatTitleCurrentuserText.data == toOnlineNickname) {
        alert("\u4e0d\u80fd\u5bf9\u81ea\u5df1\u804a\u5929\uff0c\u8bf7\u9009\u62e9\u522b\u7684\u5176\u4ed6\u7528\u6237");
    } else {
        var optionLength = sendToUserSelect.options.length;
        var tag = 0;
        for (index = 0; index < optionLength; index++) {
            if (sendToUserSelect.options[index].value == toOnlineId) {
                tag = 1;
                sendToUserSelect.options[index].selected = true;
            }
        }
        if (tag == 0) {
            var toOnlineOption = new Option(toOnlineNickname, toOnlineId);
            sendToUserSelect.options.add(toOnlineOption);
            toOnlineOption.selected = true;
        }
    }
}

//get application user name
function getApplicationUser() {
    var applicationUser = "";
    var applicationUserObject = document.getElementById("welcomeName");
    if (applicationUserObject != null) {
        if (applicationUserObject.firstChild.nodeValue.replace(/(^\s*|\s*$)/g, "").length > 0 && applicationUserObject.firstChild.nodeValue.toLowerCase() != "guest") {
            applicationUser = applicationUserObject.firstChild.nodeValue;
        }
    }
    return applicationUser.replace(/(^\s*|\s*$)/g, "");
}
function scrollTo() {
    try {
        var totalChatTableObject = document.getElementById("totalChatTable");
        var iframeDivObject1 = document.getElementById("iframeDiv");
        
        var bodyObject = getBodyObj();
        
        totalChatTableObject.style.top = parseInt(init_top, 10) + parseInt(bodyObject.scrollTop, 10) - parseInt(totalChatTableObject.offsetHeight, 10) + "px";
        totalChatTableObject.style.left = parseInt(init_left, 10) + parseInt(bodyObject.scrollLeft, 10) - parseInt(totalChatTableObject.offsetWidth, 10) + "px";
        iframeDivObject1.style.top = parseInt(init_top, 10) + parseInt(bodyObject.scrollTop, 10) - parseInt(totalChatTableObject.offsetHeight, 10) + "px";
        iframeDivObject1.style.left = parseInt(init_left, 10) + parseInt(bodyObject.scrollLeft, 10) - parseInt(totalChatTableObject.offsetWidth, 10) + "px";
        iframeDivObject1.height = parseInt(totalChatTableObject.offsetHeight, 10) + "px";
    }
    catch (e) {
    }
}
function getBodyObj() {
        return document.documentElement;
}
搜索更多相关主题的帖子: Component failure firefox 中报 returned 
2008-07-25 11:56
快速回复:Component returned failure code: 0x80040111,firefox中报错
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.048611 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved