This time, a login example
that takes ID and password input and connects them to the relevant site
example///
The explanation is sparse — I should also attach a file...
Friday nights are tough..
I came up to Seoul to crash at a friend's place but they're out, so I'm posting from a nearby cafe...
Exhausted.. couldn't even wash up.. eyes are closing... :(
Sigh, either I move up to Seoul soon, or I just wait for the academy classes to end.. :(
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
|
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ko" lang="ko"> |
|
|
|
|
|
<head> |
|
|
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" /> |
|
|
<title>Window Object Events & Event Handlers 4</title> |
|
|
|
|
|
<meta name="Keywords" content="" /> |
|
|
<meta name="Description" content="" /> |
|
|
|
|
|
<script type="text/javascript"> |
|
|
//<![CDATA[ |
|
|
|
|
|
function id_focus(){ |
|
|
frm=document.loginForm; // because var is omitted, it becomes a global variable |
|
|
frm.loginId.focus(); |
|
|
} |
|
|
|
|
|
// blank-field validation check |
|
|
function submitForm() { |
|
|
var message=""; |
|
|
|
|
|
if(frm.loginID.value.length==0){ |
|
|
message="Please enter your ID"; |
|
|
objfocus=frm.login; |
|
|
}else if(frm.loginPassword.value.length==0){ |
|
|
message="Please enter your password"; |
|
|
objfocus=frm.loginPassword; |
|
|
} |
|
|
|
|
|
if(message !=""){ |
|
|
alert(message); |
|
|
objfocus.focus(); |
|
|
return false; |
|
|
} |
|
|
frm.submit(); |
|
|
} |
|
|
|
|
|
//]]]]]]> |
|
|
</script> |
|
|
</head> |
|
|
|
|
|
<body onload="id_focus()"> |
|
|
<form id="loginForm" name="loginForm" action="http://www.naver.com" method="post" onsubmit="return submitForm();" > |
|
|
<p> |
|
|
<label for="loginID">User ID</label> |
|
|
<input type="text" name="loginID" id="loginID" value=""> |
|
|
</p> |
|
|
<p> |
|
|
<label for="loginPassword">User Password</label> |
|
|
<input type="password" name="loginPassword" id="loginPassword" value=""> |
|
|
</p> |
|
|
<p> |
|
|
<input type="image" src="../images/submit.gif" alt="Log in"> |
|
|
<!-- onsubmit="return submitForm(); — to trigger this, it must be an image. --> |
|
|
</p> |
|
|
</form> |
|
|
</body> |
|
|
|
|
|
</html> |
