1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
<html>
<head>
<script language="javascript" type="text/javascript">
function addListener(element, baseName, handler){
if (element.addEventListener)
element.addEventListener(baseName,handler,false);
else if(element.attachEvent)
element.attachEvent("on"+baseName, handler);
}
function bloque_form(){
this.onsubmit = function(){return false;};
}
function initEventHandlers(){
addListener(document.forms["myform"],"submit",function(){
if (document.getElementById("c1").value != "a")
bloque_form();
});
}
</script>
</head>
<body>
<form method="post" name="myform" action="file.php">
<input type="text" name="c1" id="c1" value="" />
<input type="submit" value="send"/>
</form>
<script language="javascript" type="text/javascript">
addListener(window,"load",initEventHandlers);
</script>
</body>
</html> |