form中有二个select,一个是年,一个是月,想通过两个select的onchange事件,自动刷新页面,并根据select中的值自动生成一个多行的表格,可以进行进一步的输入。如:选择2008年2月,就生成一个29行的表格。选择2008年5月就生成31行的表格,在表格的第一列加上日期。

解决方案 »

  1.   

    你描述的很清晰啊 ,不像其它同学一样?感觉你自己可以慢慢的去实现 ,既然知道onchange ,那就继续啊:比如 selectObj.onchange = function(){
       //去实现的想法啊
    };
      

  2.   

    javascript我是不会的,我只会写asp的代码,找了一些javascript原代码,相近的没有,所以只好请教高手。
      

  3.   

    <title>ceshi</title>
    <script language="javaScript">function select354(obj){
        if (obj.value == "1"){
        zj_num.style.display = "none";
    zj_type.style.display = "none";
    no_num.style.display = "block";
    }
    if (obj.value == "2"){
        zj_num.style.display = "block";
    zj_type.style.display = "block";
    no_num.style.display = "none";

    }

    }
    </script>
    </head>
    <body scroll="no">
      <table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0"  class="maintable">
        <tr>
          <td width="4">
         <img src="../../images/core/spacer.gif" width="4" height="4">
       </td>
          <td width="100%" height="100%">
            <table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">


              <tr height="100%">
                <td align="center" valign="top" class="center">




                
                  <table width="350" border="0" cellpadding="0" cellspacing="0" align="center">
                    
                    <tr>
                      <td align="center"><form name="form1" method="post" action="">
      <table cellpadding="0" cellspacing="0" border="0">
         <tr>
                      <td align="right">查询方式</td>
                      <td><select name="selectcha" onChange="select354(this)" id="selectcha">
                        <option value="1" selected="selected">卡号</option>
                        <option value="2">证件号</option>
                      </select></td>
                    </tr>
                      <tr id="no_num" style="display:block;">
                      <td align="right">卡号</td>
                      <td>
                         <input type="text" name="no_num" id="list_no_num" />
                      </td>
                    </tr>
                    <tr id="zj_type" style="display:none;">
                      <td align="right">证件类型</td>
                      <td>
                         <input type="text" name="zj_type" id="list_zj_type"/>
                      </td>
                    </tr>
    <tr id="zj_num" style="display:none;">
                      <td align="right">证件号码</td>
                      <td>
    <input type="text" name="zj_num" id="list_zj_num"/>
      </td>
                    </tr>
                    

    </table></form>
      </td>
                      
                    </tr>
                    
                  </table>
                </div>
    </td>
              </tr>
            </table>
     
        </tr>

      </table>
    </body>
    </html>
    自己運行一下,可以參考一下
      

  4.   


    <html> 
    <head> 
    <script language="javascript" type="text/javascript"> 
    <!-- hide script from old browsers 
    function msg() 

           // var status = " <% cfg_get("ddns_error"); %>"; 
            //confirm('test 002'); 
            //document.write('hello world.'); 
            return 1; 

    function show_message() 

            setTimeout("self.location.reload();",1000);        
            //var status = " <% cfg_get("ddns_error"); %>"; 
           // confirm('test 001'); 
            if(msg() == 1) 
            {                                                  
                  //  setTimeout("self.location.reload();",1000);          
                    //setTimeout("window.location.href='test.html'",5000); 
                 // document.write('<b>' + (new Date).toLocaleString() + '</b>');//用来测试是否刷新
            } 
    }                                                                    
    //-->                                                                
    </script>                                                            
    </head>                                                              
    <body >     
    <input type="button" value="refresh" onClick="show_message();">  
    <script language="JavaScript">
    <!--
        // we put this here so we can see something change
        document.write('<b>' + (new Date).toLocaleString() + '</b>');
    //-->
    </script>
               
    </body>                                          
    </html> 楼主可以参考上述代码的自动页面刷新功能,这样解决您的问题就简单了
      

  5.   

    不好意思,刚代码拷贝错误了,参考下面代码
    <html><head>
    <title>Refresh JavaScript Example</title>
    <noscript>
    <!--
        We have the "refresh" meta-tag in case the user's browser does
        not correctly support JavaScript or has JavaScript disabled.    Notice that this is nested within a "noscript" block.
    -->
    <meta http-equiv="refresh" content="2"></noscript><script language="JavaScript">
    <!--var sURL = unescape(window.location.pathname);
    function refresh()
    {
        window.location.href = sURL;
    }
    //-->
    </script></head><!--
        Use the "onload" event to start the refresh process.
    -->
    <body onLoad="doLoad()"><script language="JavaScript"><!--
        function doLoad()
    {
    // the timeout value should be the same as in the "refresh" meta-tag
    setTimeout( "refresh()", 2*1000 );
    }
        // we put this here so we can see something change

        document.write('<b>' + (new Date).toLocaleString() + '</b>');
    -->
    </script>
    </body></html>