HTML form input tag name element array with JavaScript

前端 未结 5 1778
终归单人心
终归单人心 2020-11-30 03:20

This is a two part question. Someone answered a similar question the other day (which also contained info about this type of array in PHP), but I cannot find it.

1.

5条回答
  •  半阙折子戏
    2020-11-30 04:08

    document.form.p_id.length ... not count().

    You really should give your form an id

    Then refer to it using:

    var theForm = document.getElementById("myform");
    

    Then refer to the elements like:

    for(var i = 0; i < theForm.p_id.length; i++){
    

提交回复
热议问题