Heim > Backend-Entwicklung > PHP-Tutorial > input取值,该如何解决

input取值,该如何解决

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Freigeben: 2016-06-13 12:25:53
Original
847 Leute haben es durchsucht

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>
Nach dem Login kopieren

点击确定能获取文本框输入的值 有没有可能实现
------解决思路----------------------
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 />
Nach dem Login kopieren
res 中就是

Verwandte Etiketten:
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage