<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.111cn.net/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title>ajax post傳值和get傳值執行個體</title>
<script language="網頁特效">
function posttext()
{
var chatbox = document.getelementbyid( "utext" );
var chat = chatbox.value;
var getuser ='admin';
var getuserid ='1';
chatbox.value = "";
var url = ajaxserverpagename+"?active=addtext&user=" + getuser + "&userid=" + getuserid + "&text=" + chat;
var req = getajax();
req.onreadystatechange = function(){
if( req.readystate == 4 && req.status == 200 ) {
req=null;
updateall();
}
}
req.open( 'get', url, true );
req.send( null );
url=null;
chat=null;
chatbox=null;
}
</script>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<p>
<label for="utext"></label>
<textarea name="utext" id="utext" cols="45" rows="5"></textarea>
</p>
<p>
<input type="submit" name="button" id="button" value="提交" />
</p>
</form>
</body>
</html>