0
<html dir = rtl>
    <head>
        <title> </title>
        <meta HTTP-EQUIV="Content-language" CONTENT="ar">
        <script type="text/javascript">
            function CheckForm(String)
            {
                 var pNames = [ "sName", "sAge", "sAddress"];
                 for (var i = 0; i < 4;i++)
                 {
             if (Infi[i].value == "")
                         document.getElementById(pNames[i]).innerHTML = 'عفواً لاتوجد قيمة في الحقل';
                 }
            }

        </script>
    </head>
    <body>
       <form name = "Info" method = "set" action = "#">
           <table  border = "0" width = "80%" align = "center">
               <tr>
                   <td align = "left"> الاســــــــــــــــم: </td>
                   <td > <input type="text" name = "CurName" size = "31"> <p id = "sName" style = "display: inline"> </p> </td>
               </tr>

               <tr>
                   <td align = "left"> العــــــــــــــــمر :</td>
                   <td> <input type = "text" name = "CurAge" size = "10"> <p id = "sAge" style = "display: inline"> </p> </td>
               </tr>

               <tr>
                   <td  align = "left"> العنـــــــــــــوان :</td>
                   <td> <input type = "text" name = "CurAddress" size = "45"> <p id = "sAddress" style = "display: inline"> </p> </td>
               </tr>

               <tr>
                   <td  align = "left"> الحالــــــــــــــــة :</td>
                   <td> <input type = "radio" name = "Mar" > متزوج<input type = "radio" name = "Sin" checked="yes"> أعزب </td>
               </tr>

               <tr>                   
                  <td colspan = 2 align = center> <button type = "button" onclick = "CheckForm(); return false;">ارسال </button>  <button type = "reset">مسح</button> </td>                 
               </tr>
          </table>
       </form>
    </body>
</html>

我想检查表格框是否为空,我尝试了很多但没有任何效果,所以请任何人都可以帮助我,对不起我的英语不好

4

3 回答 3

3

您的表格名称是Info,不是Infi。看来你有错字。

这个:

if (Infi[i].value == "")

应该是这样的:

if (Info[i].value == "")
于 2013-05-26T11:56:53.077 回答
2

您必须更正代码中的错字:

您的表单名称必须是Info而不是Infi

于 2013-05-26T11:58:40.060 回答
1

Infi 未定义错误。您没有定义 infi ..

于 2013-05-26T11:57:47.067 回答