|
 |
|
ช่วยดูหน่อยค่ะ ajax ทำไมไม่ทำงานค่ะ ระบบ chat ....ยินดีต้อนรับสู่ห้อง Chat คุยกันแบบเพื่อนค่ะ |
|
 |
|
|
 |
 |
|
index.html
Code (PHP)
<html>
<head>
<form action="chatroom.php" method="post">
<script src="/ajaxbook/ajax_framework.js"></script>
<script>
function ajaxSubmit() {
var data = gerFormData("frm");
var URL = "add_nickname_ss.php";
afaxLoad('post', URL, data, 'msg');
}
</script>
</head>
<body> <center>
<BODY BACKGROUND="file:///C:/Appserv/www/chat/t_101757434.gif">
<center>
<FONT COLOR=#330099>
<h1>ยินดีต้อนรับสู่ห้อง Chat คุยกันแบบเพื่อนค่ะ</h1>
<div id="msg" style="color":red"></div>
<div style="ackground-color:#eeeeff;padding:5px;">
<form name="frm">
<FONT COLOR=#FF0000>
<FONT SIZE=5>
ใส่ชื่อที่นี่ค่ะ
<input type="text" name="nickname" size="30" maxlength="30">
<input type=submit value="ตกลง">
</form>
</div>
</body>
</html>
chatroom.php
Code (PHP)
<?session_start;?>
<html>
<head>
<title><?php echo $_SESSION['nickname']; ?></title>
<style>
body, td {
font:13pt tahoma
}
.iframe_title {
background-color:#FF6EB4;
color:#0000FF;
padding:7px;
}
</style>
<script src="/afaxbook/ajax_framework.js"></script>
<script>
function afaxSubmit() {
var data = getFormData("frm");
var URL = "add_msg_ss.php";
ajaxLoad('post', URL, data, 'info');
document.getElementById('msg').value = "";
}
function exitChat() {
if(!confirm('ออกจากห้องสนทนาแล้วเหรอค่ะ ?')){
return;
}
var data = getFormData("frm");
var URL = "exit_chatroom_ss.php";
ajaxLoad('post', URL, data, 'info');
document.getElementById('msg').value = "";
}
function isPressEnter() {
if(event.keyCode==13){
afaxSubmit();
return false;
}
}
</script>
</head>
<body>
<center>
<BODY BGCOLOR="#FFDAB9">
<FONT COLOR=#006400><h1>ห้องสนทนา chat online</h1>
<p>
<table>
<tr valign="top">
<td width="700">
<div class="iframe_title">ห้องสนทนา</div>
<iframe src="show_msg.html" width="700" height="500"
scrolling="yes">
</iframe>
</td>
<td>
<div class="iframe_title">ผู้ร่วมสนทนา</div>
<iframe src="show_catter.html" width="300" height="500"
scrolling="yes">
</iframe>
</td>
</tr>
<tr valign="top">
<td>
<form name="frm">
<input type="hidden" name="nickname"value="<?php echo $_SESSION['nickname']; ?>">
ข้อความ :
<input type="text" id="msg" name="msg" size="55" maxlength="250"
style="background-color:#ffffcc; "
onkeypress="return isPressEnter()">
<button onclick="ajaxSubmit()">ส่ง </button> หรือกด <Enter>
<br>
สีข้อความ :
<input type="radio" name="color" value="black" checked>ดำ
<input type="radio" name="color" value="red">แดง
<input type="radio" name="color" value="blue">น้ำเงิน
<input type="radio" name="color" value="green">เขียว
<input type="radio" name="color" value="orange">ส้ม
<input type="radio" name="color" value="pink">ชมพู
</form>
</td>
<td align="right">
<button onclick="exitChat()">ออกจากห้องสนทนา</button>
</td>
</tr>
</table>
<div id="info"></div>
</body>
</html>
Tag : - - - -

|
|
 |
 |
 |
 |
Date :
2010-01-24 23:21:55 |
By :
Ninezy |
View :
1163 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
chatroom.php
บรรทัด 17
|
 |
 |
 |
 |
Date :
2010-01-25 00:44:48 |
By :
mr.v |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 01
|