有谁知道制作弹出聊天窗口的代码。发送消息时如何通知用户?如何让用户的窗口聚焦?或闪烁弹出窗口。目前我有这个代码:
function stateChangeHandler() {
//readyState of 4 or 'complete' represents that data has been returned
if (xmlHttp.readyState == 4 || xmlHttp.readyState == 'complete') {
//Gather the results from the callback
var str = xmlHttp.responseText;
if (str != "") {
var chatmsgs = eval(str);
for (ind = 0; ind < chatmsgs.length; ind++) {
var senderId = chatmsgs[ind].Sender;
var chatId = chatmsgs[ind].ChatId;
var message = chatmsgs[ind].Msg;
var msgId = chatmsgs[ind].MsgId;
message = restoreHtmlTags(message);
document.getElementById('msgPanel').innerHTML += "<br><b>" + senderId + ": </b>" + message;
MessageReceived(msgId, msgCounter);
document.getElementById('msgPanel').scrollTop = document.getElementById('msgPanel').scrollHeight;
window.focus();
}
}
}
}
它只在 Internet Explorer 中工作,Firefox 和 Chrome 不工作。