サーバーにデータを送るには

<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Sample</title>
<script type="text/javascript"><!--
function getFile() {
xmlhttp = createXMLHttp();
if (xmlhttp) {
xmlhttp.onreadystatechange = check;
xmlhttp.open("GET", "sample.txt", true);
xmlhttp.send(null);
}
}
function check() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.aForm.tArea.value = xmlhttp.responseText;
}
}
function saveFile()
{
txt = document.aForm.tArea.value;
if (xmlhttp) {
xmlhttp.open("GET", "save.cgi?tArea="+escape(txt), true);
xmlhttp.send(null);
}
}
// XMLHttpオブジェクト作成
function createXMLHttp() {
try {
return new ActiveXObject ("Microsoft.XMLHTTP");
}catch(e){
try {
return new XMLHttpRequest();
}catch(e) {
return null;
}
}
return null;
}
// --></script>
</head>
<body onLoad="getFile()">
<form name="aForm">
<input type="button" value="ファイルを保存する" onClick="saveFile()"><br>
<textarea cols="40" rows="20" name="tArea"></textarea>
</body>
</html>
・サンプルを実行
・サンプルをダウンロード
逆引きクイックリファレンス JavaScript 説明などは本書を参考にしてください。