html 如何获取表格中所选行的一行数据,并赋值到对应的TEXT里面?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>无标题文档</title> <script language="javascript"> function cc(){ var bb=document.getElementById("abc").getElementsByTagName("td"); for(var i=0;i<bb.length;i++){ bb[i].onclick= function(){ document.form1.txt.value=this.innerText; } } } </script> </head>
<body> 点下单元格看看 <table width="600" border="1" cellspacing="0" cellpadding="0" id="abc"> <tr> <td height="20" align="center">11</td> <td align="center">22</td> <td align="center">33</td> </tr> <tr> <td height="20" align="center">wer</td> <td align="center">werf</td> <td align="center">sdf</td> </tr> <tr> <td height="20" align="center">sdf</td> <td align="center">wer</td> <td align="center">ewr</td> </tr> <tr> <td height="20" align="center">sdf</td> <td align="center">sdf</td> <td align="center">sdf</td> </tr> </table> <p> </p> <form id="form1" name="form1" method="post" action=""> <input type="text" name="txt" id="txt" /> </form> <p> </p> <p><br /> </p> <script language="javascript"> cc(); </script> </body> </html>
点下单元格看看
11 | 22 | 33 |
wer | werf | sdf |
sdf | wer | ewr |
sdf | sdf | sdf |
html 如何获取表格中所选行的一行数据,并赋值到对应的TEXT里面?的更多相关文章
- js获取表格视图所选行号的ids
实例化数组 遍历所选行push到数组中 将数组join转换为以,分割的字符串 /*获取指定id的datagrid的表格视图的选择的ids*/ function getDataGridSelectRow ...
- dojo中获取表格中某一行的某个值
dojo中经常出现对表格中的某行进行操作,如单击某行修改.删除等.那怎样获取某行的唯一标示呢? 如查询表格中的某列有个userId,并且这个是唯一的,那么可以通过它来访问这一列 具体操作代码如下: v ...
- 如何获取jqGrid中选择的行的数据
原文地址:http://hi.baidu.com/feifan3211/item/c5831f44158761a5df2a9fc1 如何获取jqGrid中选择的行的数据? 下面可以获取选择一行的id, ...
- 获取jqGrid中选择的行的数据以及 jqGrid获得所有行数据的方法
获取jqGrid中选择的行的数据: 获取选择一行的id,如果你选择多行,那下面的id是最后选择的行的id: 1 var id=$('#gridTable').jqGrid('getGridPara ...
- Vue. 之 Element获取table中选中的行
Vue. 之 Element获取table中选中的行 问题描述: 如下截图,在Table中选择数据后,然后在点击“统计”按钮,获取Table表中选择的行 解决方案: 1. 给“统计”这个按钮添加一个点 ...
- php如何实现把多平台文件中所有的行合成一行?
php如何实现把多平台文件中所有的行合成一行? 一.总结 1.str_replace中的数组替换:str_replace(array("/r","/n",&qu ...
- 用JavaScript,获取Table中指定的行、列
前言: 先要谢谢George Wing的慷慨赠书<悟透JavaScript>,让我更加感受到了技术交流的重要性,呵呵~ 进入正题,面试题中有一题:如何通过JavaScript获取Table ...
- C# 在Word表格中插入新行(表格含合并行)
public string CreateWordFile(string CheckedInfo) { string message = "" ...
- 用python+openpyxl从表格中读取测试用例的多条数据,然后将执行结果写入表格中
# -*- coding: utf-8 -*- from selenium import webdriver from openpyxl import load_workbook class mylo ...
随机推荐
- 检测内存泄露:Instruments中的Leaks
前言 如果要检测内存泄露,我们会使用Xcode7自带的Instruments中的Leaks工具来检测. 现在的开发环境是ARC,所以很少会出现内存泄漏的情况. 不过我们一定要养好码代码的规范性. 例如 ...
- Spring中@Cacheable的用法
在Spring中通过获取MemCachedClient来实现与memcached服务器进行数据读取的方式.不过,在实际开发中,我们往往是通过Spring的@Cacheable来实现数据的缓存的,所以, ...
- IOS中两个view的切换
在ios中,rootview为PassWordViewController,secondview为SecondViewController,实现在rootview中听过一个跳转按钮实现跳转到secon ...
- 用R分析时间序列(time series)数据
时间序列(time series)是一系列有序的数据.通常是等时间间隔的采样数据.如果不是等间隔,则一般会标注每个数据点的时间刻度. time series data mining 主要包括decom ...
- 20151210001 DataGridView 选中与被选中
// DataSet_IP list private void DataSet_IP_list() { DataSet_IP = new System ...
- 多校赛3- Solve this interesting problem 分类: 比赛 2015-07-29 21:01 8人阅读 评论(0) 收藏
H - Solve this interesting problem Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I ...
- 2016年11月3日 星期四 --出埃及记 Exodus 19:19
2016年11月3日 星期四 --出埃及记 Exodus 19:19 and the sound of the trumpet grew louder and louder. Then Moses s ...
- IDEA打war包
一 第一步创建一个web application:expolded 选择当前项目 二 新建一个web application: Archive 选择刚刚新建的Expoded “For ‘...... ...
- SQL 数据库的备份,还原,分离和附加以及聚合函数
数据库备份 数据库备份可以手动备份和语句备份 一.手动备份数据库 1.鼠标右键选择你要进行备份的数据库-任务-备份 可以在常规选项页面你可以选择备份类型是进行完整数据库备份还是差异数据库备份 2.点击 ...
- 零零碎碎写的shell脚本(三):一键自动归档压缩脚本
#!/bin/bash # author by sysk read -p "There files: " FILE1 FILE2 FILE3 read -p "Desti ...