<form action="login.php" method="post" target="userlogin" name="loginform">
<div class="TxtUser" id="userlogindiv">
用戶名:<input name="accounts" id="accounts" type="text" size="18" >
密碼: <input name="passwords" id="passwords" type="password" size="18" >
<input type="submit" name="Submit" value="登錄" />
</div>
</form>
<iframe name="userlogin" width="1" height="1" ></iframe>
login.php頁面:
<?
$accounts=$_POST['accounts'];
$passwords=$_POST['passwords'];
$showdata="我登錄啦!!";
if($accounts=="admin" && $passwords=="123456")
{
echo'<script language="JavaScript"> ';
echo'parent.document.getElementById("userlogindiv").innerHTML=\''.$showdata.'\';';
echo'</script>';
}
?>