Home >Backend Development >PHP Tutorial >input取值,该如何解决

input取值,该如何解决

WBOY
WBOYOriginal
2016-06-13 12:25:53826browse

input取值

<table width="100%" border="0" cellspacing="0" cellpadding="0"><br />    <tr><td><br />    <div class="jindu_anniu"><br />	<form><br />	<input type="button"  class="anniu4" value="确定" /><br />    </form></div><br />    </td></tr><br />  <tr><br />    <td><br />    <div class="true_body"><br /><br /><br /><br /><br /><br /><table width="100%" border="0" cellspacing="0" cellpadding="0" class="ttbb5"><br />    <tr><br />    <th scope="col"><strong>序号</strong></th><br />    <th scope="col">国家</th><br />    <th scope="col">省份</th><br />	<th scope="col">地区</th><br />    <th scope="col">操作</th><br />    <br />  </tr><br />    <br />  {if $list or [email&#160;protected] neq 0 }<br /> 	{foreach from=$list item=item key=index}<br />	<tr align="center"><br />    <td>{$index}</td><br />	{if $item.parent_tow_id eq 2}<br />	<td class="ttbb6">{$item.country}</td><br />	<td class="ttbb6">{$item.province}</td><br />    <td class="ttbb6">{$item.name}</td><br />	{/if}	<br />	{if $item.parent_tow_id eq 1}<br />	<td class="ttbb6">{$item.country}</td><br />	<td class="ttbb6">{$item.name}</td><br />    <td class="ttbb6"></td><br />	{/if}	<br />	{if $item.parent_tow_id eq 0}<br />	<td class="ttbb6">{$item.name}</td><br />	<td class="ttbb6"></td><br />    <td class="ttbb6"></td><br />	{/if}<br />    <td class="ttbb6">  <input type="text" name="p" id="p" /> </td><br />	</tr><br />	{/foreach}<br />	{else}<br />	 <tr><br />    <td align="center" colspan="5">--暂无数据--</td><br />  	</tr><br />	{/if}<br /><br />    </table><br />    {include file=warning.tpl}<br /><br /></div><br />    </td><br />  </tr><br /><br />这个效果<br /></table>

点击确定能获取文本框输入的值  有没有可能实现
------解决思路----------------------
onclick='foo()' />
<script><br />function foo() {<br />  var res = [];<br />  var texts = document.getElementsByName("p");<br />  for(var i in texts) res.push(texts[i].value;<br />}<br /></script><br />
res 中就是

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn