zoukankan      html  css  js  c++  java
  • 表单2016/4/8

    <!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">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <script>
    window.onload=function ()
    {
    	var oForm=document.getElementById('form1');
    	var oUser=document.getElementsByName('user')[0];
    	var oPass=document.getElementsByName('pass')[0];
    	
    	oForm.onsubmit=function ()
    	{
    		if(oUser.value=='' || oPass.value=='')
    		{
    			alert('您填错了');
    			return false;
    		}
    	};
    	
    	oForm.onreset=function ()
    	{
    		/*if(confirm('是否要清空?'))
    		{
    			return true;
    		}
    		else
    		{
    			return false;
    		}*/
    		
    		return confirm('是否要清空?');
    	};
    };
    </script>
    </head>
    
    <body>
    <form id="form1" action="http://www.miaov.com/" method="get">
    	用户名:<input type="text" name="user" />
    	密码:<input type="password" name="pass" />
        <input type="submit" value="提交" />
        <input type="reset" value="重置" />
    </form>
    </body>
    </html>
    

      

  • 相关阅读:
    题解 P3071 【[USACO13JAN]座位Seating】
    [luogu]P3398 仓鼠找sugar
    快速输入输出
    Luogu P3939 数颜色
    HEOI2016/TJOI2016 排序
    POI2011 DYN-Dynamite
    USACO17JAN Promotion Counting
    AHOI2008 聚会
    Luogu P4907 A换B problem
    网络流24题 骑士共存问题
  • 原文地址:https://www.cnblogs.com/hduhdc/p/5367111.html
Copyright © 2011-2022 走看看