$(“form”).hide();
$(“#newConn”).show();
});
$(“#logout”).click(function () {
// 退出openfire登陆,断开链接
remote.jsjac.chat.logout();
$(“form”).show();
$(“#newConn”).hide();
$(“#chat”).hide(800);
});
$(“#newSession”).click(function () {
var receiver = $(“#sendTo”).val();
// 建立一个新聊天窗口,并设置消息接收者(发送给谁?)
$.WebIM.newWebIM({
receiver: receiver
});
});
});
</script>
</head>
<body>
<!– 登陆表单 –>
<form name=”userForm” style=”background-color: #fcfcfc; width: 100%;”>
userName:<input type=”text” name=”userName” value=”boy”/>
password:<input type=”password” name=”password” value=”boy”/>
register: <input type=”checkbox” name=”register”/>
sendTo: <input type=”text” id=”to” name=”to” value=”hoojo” width=”10″/>
<input type=”button” value=”Login” id=”login”/>
</form>
<!– 新窗口聊天 –>
<div id=”newConn” style=”display: none; background-color: #fcfcfc; width: 100%;”>
User:<label></label>
sendTo: <input type=”text” id=”sendTo” value=”hoojo” width=”10″/>
<input type=”button” value=”new Chat” id=”newSession”/>
<input type=”button” value=”Logout” id=”logout”/>
</div>
<!– 日志信息 –>
<div id=”error” style=”display: ; background-color: red;”></div>
<div id=”info” style=”display: ; background-color: #999999;”></div>
<!– 聊天来消息提示 –>
<div class=”chat-message”>
<img src=”images/write_icon.png” class=”no-msg”/>
<img src=”images/write_icon.gif” class=”have-msg” style=”display: none;”/>
</div>
</body>
</html>
下面这段代码尤为重要,它是设置你链接openfire的地址。这个地址一段错误你将无法进行通信!
<script type=”text/javascript”>
window.contextPath = “<%=path%>”;
window[“serverDomin”] = “192.168.8.22”;
</script>
$.WebIM方法是主函数,用它可以覆盖local.chat中的基本配置,它可以完成聊天窗口的创建。$.WebIM.newWebIM方法是新创建一个窗口,只是消息的接收者是一个新用户。










