Не могу передать скриптом значение формы
Имею следующий код:
<script language=JavaScript> var numb; numb = 1; function add_new_row() { var currrow; currow = document.all.myTable.rows.length-1; // вычислить количество строк в таблице numb++; document.all.myTable.insertRow(currow); // добавляем строку в таблицу document.all.myTable.rows[currow].insertCell(0); // добавляем ячейки document.all.myTable.rows[currow].insertCell(1); document.all.myTable.rows[currow].insertCell(2); document.all.myTable.rows[currow].insertCell(3); document.all.myTable.rows[currow].insertCell(4); document.all.myTable.rows[currow].insertCell(5); document.all.myTable.rows[currow].insertCell(6); document.all.myTable.rows[currow].cells[0].innerHTML = ''; document.all.myTable.rows[currow].cells[1].innerHTML = '<input type=\"text\" size=\"20\" id=\"name">'; // вставляем в форму поля document.all.myTable.rows[currow].cells[2].innerHTML = '<select id=\"type\"><?for($i=0;$i<count($arr);$i++){echo "<option value=".($i+1)." ";if (($i+1)==$row['type']) echo "selected";echo ">".$arr[$i]."</option>";}?></select>'; document.all.myTable.rows[currow].cells[3].innerHTML = '<input type=\"text\" size=\"30\" id=\"signature">'; document.all.myTable.rows[currow].cells[4].innerHTML = ''; document.all.myTable.rows[currow].insertCell(5).innerHTML = ''; document.all.myTable.rows[currow].insertCell(6).innerHTML = "<center><a onclick='document.location.href=this.href+'?&name='+document.getElementById('name').value+'&type='+document.getElementById('type').value+'&signature='+document.getElementById('signature').value+'&n=000';return false;\" href=\"edit.php\"><img src='edit.png'></a></center>"; } </script> <table id="myTable" name="table_1" border="0"> <tr align="center"> <td>Номер</td> <td>Заголовок</td> <td>Тип</td> <td>Текст</td> <td> </td> <td>Уд.</td> <td>Ред.</td> </tr> <? while ($row = mysql_fetch_array($tmp)) { echo"<tr align=\"center\">"; echo" <td>".$row['n']."</td> <td><input type=\"text\" id=\"name".$row['n']."\" size=\"20\" value=\"".$row['name']."\"></td> <td><select id=\"type".$row['n']."\">"; for($i=0;$i<count($arr);$i++){ echo "<option value=".($i+1)." "; if (($i+1)==$row['type']) echo "selected"; echo ">".$arr[$i]."</option>"; } echo"</select></td> <td><input type=\"text\" id=\"signature".$row['n']."\" size=\"30\" value=\"".$row['signature']."\"></td> <td> </td> <td><input onclick=\"document.location.href='rem.php'+'?&n=".$row['n']."';return false;\" type=button value=\"-\"></td> <td><input onclick=\"document.location.href='edit.php'+'?&name='+document.getElementById('name".$row['n']."').value+'&type='+document.getElementById('type".$row['n']."').value+'&signature='+document.getElementById('signature".$row['n']."').value+'&n=".$row['n']."';return false;\" type=button value=+></td> "; echo"</tr>"; } ?> <tr><td><input onClick="add_new_row()" type="button" value="+" name="btnNext"></td></tr> </table> В строке document.all.myTable.rows[currow].insertCell(6).innerHTML создается кнопка, которая php скрипту передает параметры из добавленных посредством Java элементов формы... тоесть по сути должно передавать значения Name, Type и т.д.... Однако не получается... значения в edit.php улетают пустыми... почему???? Не могу даже передать предопределенный элемент $n=000 |
1) document.all.myTable -> document.getElementById('myTable')
2) this.href+'?&name='+document - что это такое? 3) по какому url переходит браузер? 4) что выдает на сервере var_dump($_GET); ? 5) java это сюда |
Часовой пояс GMT +3, время: 03:41. |