<script type="text/javascript">
function send(){
var frm=document.frmC;
/* テキストボックスが空でないならTRUEを返してフォーム送信 */
if(frm.elements["message"].value!=""){
frm.action="content/demo/test.php";
frm.method="post";
frm.encoding="application/x-www-form-urlencoded";
return true;
}else{
/* テキストボックスが空の場合はFALSEを返してフォーム送信しない */
alert("テキストボックスが空の場合は送信しません");
return false;
}
}
</script>
<form name="frmC" action="#" onsubmit="return send();">
<input type="text" name="message" size="40" value="テキストボックスが空でないなら、送信します。" />
<input type="submit" value="送信" />
</form>