zoukankan      html  css  js  c++  java
  • table行编辑

    一个简单的Demo

    <html>
    	<head>
    		<title>Table Test Demo</title>
    		<style>
    			.view_table {
    				800px;
    				height:auto;
    				margin:0px auto;
    			}
    			
    			.view_table table {
    				 100%;
    				font-size: 12px;
    				font-family: "Microsoft YaHei" !important;
    				text-align: center;
    			}
    			
    			.view_table table tr td {
    				border: 1px green solid;
    				background-color: #cccccc;
    				line-height: 30px;
    				 80px;
    			}
    		</style>
    	</head>
    	<body>
    		<div class="view_table" name="viewTab">
    			<table border="0" cellpadding="0" cellspacing="0">
    				<tr>
    					<td>1</td>
    					<td>2</td>
    					<td>3</td>
    					<td>4</td>
    					<td><input type="button" value="edit"></td>
    				</tr>
    				<tr>
    					<td>1</td>
    					<td>2</td>
    					<td>3</td>
    					<td>4</td>
    					<td><input type="button" value="edit"></td>
    				</tr>
    				<tr>
    					<td>1</td>
    					<td>2</td>
    					<td>3</td>
    					<td>4</td>
    					<td><input type="button" value="edit"></td>
    				</tr>
    				<tr>
    					<td>1</td>
    					<td>2</td>
    					<td>3</td>
    					<td>4</td>
    					<td><input type="button" value="edit"></td>
    				</tr>
    				<tr>
    					<td>1</td>
    					<td>2</td>
    					<td>3</td>
    					<td>4</td>
    					<td><input type="button" value="edit"></td>
    				</tr>
    			</table>
    		</div>
    	</body>
    	<script src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script>
    	<script>
    		(function(){
    			$('input[type="button"]').on('click', function(){
    				var $this = $(this),
    					$td_arr = $this.parent().html('complete').prevAll('td');
    				$.each($td_arr, function(){
    					var $td = $(this);
    					$td.html('<input type="text" value="'+$td.html()+'">');
    				});
    			});
    		})();
    	</script>
    </html>


  • 相关阅读:
    取目标描述
    DCLF RCVF SNDF SNDRCVF等用法
    CL过程监控JOB的错误消息
    取用户配置文件属性
    SNDBRKMSG 例子
    信息操作
    文件下载解决中文乱码
    table行的上移下移 上下移动
    常用表操作Sql语句
    sql删除重复行
  • 原文地址:https://www.cnblogs.com/lytwajue/p/7259562.html
Copyright © 2011-2022 走看看