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 ...
随机推荐
- Hibernate,JPA注解@SecondaryTables
使用类一级的 @SecondaryTable或@SecondaryTables注解可以实现单个实体到多个表的映射. 使用 @Column或者 @JoinColumn注解中的table参数可指定某个列所 ...
- Oracle PL/SQL之LOOP循环控制语句
在PL/SQL中可以使用LOOP语句对数据进行循环处理,利用该语句可以循环执行指定的语句序列.常用的LOOP循环语句包含3种形式:基本的LOOP.WHILE...LOOP和FOR...LOOP. LO ...
- php连接函数implode()和分割explode()
php可以将字符串分割成数组,同时翻过了也可以将数组连接成字符串,确切的说是可以将数组元素连接成字符串,有了这两个函数我们就可以在数组与字符串之间进行自由转换了,下面看正文的例子吧. implode( ...
- CentOS系统没有javac命令
自己捯饬的linux系统(CentOS)安装了jdk后,只能识别java命令而不识别javac.根据网上的教程设置环境变量后还是不行. 后来看了下/usr/java/jdk**目录下面根本没有java ...
- Code(组合数学)
Code Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 8766 Accepted: 4168 Description Tran ...
- Educational Codeforces Round 16 A
Description he only king stands on the standard chess board. You are given his position in format &q ...
- 在Visual Studio中使用MonoTouch开发iOS应用程序
前段时间在工作机上装了Mac OS X,这主要是因为我最近需要开发iPhone应用程序.虽然Xcode,Objective C一定是开发iOS应用程序的主流,但是经过一番考虑,我还是决定尝试一下使用M ...
- 【Linux】linux常用基本命令
Linux中许多常用命令是必须掌握的,这里将我学linux入门时学的一些常用的基本命令分享给大家一下,希望可以帮助你们. 这个是我将鸟哥书上的进行了一下整理的,希望不要涉及到版权问题. 1.显示日 ...
- HDU 4870 Rating 概率DP
Rating Time Limit:5000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Statu ...
- Cheatsheet: 2015 03.01 ~ 03.31
Web The Architecture of Algolia's Distributed Search Network No promises: asynchronous JavaScript wi ...