⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bb.js

📁 非常简单的JavaScript练习例子 简单的验证
💻 JS
字号:
function isrequired(thefield)
{
   if(thefield.value=="")
   {
     alert("请输入数据!!!");
     return false;
   }
   else
   {
      return true;
   }
}
function isnumber(theinput)
{
  if(isrequired(theinput)==true)
  {
   for(var i=0;i<theinput.length;i++)
   {
     var isnum=theinput.substring(i,i+1);
     if(isnum<"0"||isnum>"9")
     {
       alert("请输入数字");
       return false;
     }
     else
     {
        return true;
     }
   }
   }
}
function isemail(theinput)
{
  if(isrequired(theinput)==true)
  {
     var isnum=theinput.value.indexOf("@");
     if(isnum!=-1&&theinput.value.indexOf(".")!=-1)
     {
        alert("thank! ! !");
        return true;
     }
     else
     {
        alert("请输入正确的邮箱地址! ! !");
        theinput.value="";
        return false;
     }
  }
}
function iszip(theinput)
{
  if(theinput.value.length!=6)
  {
     alert("邮编错误");
     theinput.value="";
     return false;
  }
  else
  {
    isnumber(theinput);
  }
}
function isdate(theinput)
{
    if(isrequired(theinput)==true)
    {
       var thechar=theinput.value.substring(4,5);
       if(thechar!="/")
       {
          alert("请输入正确的日期格式(如2000/12/25)");
          return false;
       }
       else
       {
         if(confirm("交货日期为"+theinput.value+"。"))
          {
             alert("谢谢你,我们将及时与你联系,准时交货!!");
          }
          else
          {
             theinput.value="";
             isrequired(theinput);
          }
       }
    }
}
function quxiao()
{
   parent.contents.document.menu.morden.checked=false;
    parent.contents.document.menu.print.checked=false;
     parent.contents.document.menu.photoshop.checked=false;
     alert("请重新选择物品");
  
}
function queren()
{
    if(order.date.value==""||order.adress.value==""||order.name.value==""||order.trade.value=="0")
    {
      order.action="";
      alert("请填写用户信息,选择产品,填上该产品的数量\n确认后,在送出该数据!");
      return false;
    }
    else
    {
      alert("谢谢你订购本公司的产品!");
    }
}

























⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -