prototype 1.5アプリケーション--簡単なフォーム提出検証
3873 ワード
prototype 1.5アプリケーション--簡単なフォーム提出検証
JAVASCRIPT ::
function aaa(){
if($F('name')==""){
new Element.update("div1","<div> </div>");
new Field.focus("name");
return false;
}else new Element.update("div1","");
if($F('pass')==""){
new Element.update("div2","<div> </div>");
new Field.focus("pass");
return false;
}else new Element.update("div2","");
new Form.disable('mf');
}
HTML ::
<script language="javascript" src="prototype.js"></script>
<form id="mf">
<input type="text" id="name"><div id="div1"></div>
<input id="pass" type="password"><div id="div2"></div>
<input type="button" onclick="javascript:aaa();" value=" ">
<input type="button" onclick="javascript:new Form.reset('mf');" value=" ">
</form