今天有点累了,就不多做其他的描述解释。在插入的代码里相关解释也都有。

<!--<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html xmlns="http://www.w3.org/1999/xhtml">--> <!--<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">-->
<!DOCTYPE html>
<html>
<head>
<!-- <base href="<%=basePath%>">--> <!-- <%@ include file="/include/meta.jsp"%>
<title>My JSP 'hello.jsp' starting page</title>-->
<meta charset="UTF-8">
<script src="js/jquery.js"></script>
<!-- <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">-->
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
--> </head>
<style type="text/css">
div{
margin-left: 30px;
} table{
border: 1px double #b8d4d1;
/*消除表格之间的间距*/
border-collapse: collapse; } th{
border-top: 1px double #b8d4d1;
border-right: 1px double #b8d4d1;
font-size: 20px;
text-align: center;
/*必须存在最大的宽度否则td里的信息不会缩略显示*/
max-width: 50px;
/*规定段落中的文本不进行换行*/
white-space: nowrap;
/*内容过多的隐藏*/
overflow: hidden;
/*溢出的文字显示为省略号*/
text-overflow: ellipsis;
/*消除表格之间的间距*/
/*border-collapse: collapse;*/
background: linear-gradient(#cafce7,#ffffff);
background:-moz-linear-gradient(top,#cafce7,#ffffff);
background:-webkit-linear-gradient(top,#cafce7,#ffffff);
}
td {
border-top: 1px double #b8d4d1;
border-right: 1px double #b8d4d1;
text-align: center; /*必须存在最大的宽度否则td里的信息不会缩略显示*/
max-width: 50px;
/*规定段落中的文本不进行换行*/
white-space: nowrap;
/*内容过多的隐藏*/
overflow: hidden;
/*溢出的文字显示为省略号*/
text-overflow: ellipsis;
/*消除表格之间的间距*/
/*border-collapse: collapse;*/
/* background: linear-gradient(#cafce7,#ffffff);
background:-moz-linear-gradient(top,#cafce7,#ffffff);
background:-webkit-linear-gradient(top,#cafce7,#ffffff);*/
} #top{
height: 100px;
}
#bottom{
height: 400px;
border: 1px double #b8d4d1;
}
/*鼠标停留在tr标签上时改变颜色*/
tr:hover{
background-color: #e4e8ec; }
</style> <script src="js/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
//将点击的tr对象化
$("tr").click(function () {
//在点击事件里使用children()方法和eq(1)方法获取tr下的每个td元素的内容
var username=$(this).children().eq(1).text();
var password=$(this).children().eq(2).text();
//在个input标签赋值
$("#username").val(username);
$("#password").val(password); });
}); </script> <body>
<div id="top">
<form action="myUser/save" method="post">
<input type="hidden" name="id"/>
帐号:<input type="text" id="username" name="username"/><br/>
密码:<input type="text" id="password" name="password"/><br/>
<input type="submit" style="float:none;" value="保存"/>
</form>
</div> <div id="bottom">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<thead>
<tr>
<th>序号</th>
<th>帐号</th>
<th>密码</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<!-- <c:forEach items="${pageInfo.content}" var="MyUser" varStatus="status">
<tr>
<td>
${status.count}
</td>
<td>
${MyUser.username}
</td>
<td>
${MyUser.password}
</td>
<td><a href="myUser/del?id=${MyUser.id}">删除</a></td>
</tr>
</c:forEach>-->
<tr>
<td>主键</td>
<td>帐号</td>
<td>密码</td>
<td>操作</td>
</tr>
<tr>
<td>主</td>
<td>帐号1</td>
<td>密码1</td>
<td>操作</td>
</tr>
</tbody>
</table>
</div>
<!--<tags:pagination page="${pageInfo}" paginationSize="5"/>-->
</body>
</html>

jquery获取点击标签内的子标签内容和值实例的更多相关文章

  1. 织梦channel标签内调用子栏目内容

    文件:include\taglib\channel.lib.php 把代码 SELECT id,typename,typedir,isdefault,ispart,defaultname,nameru ...

  2. MyBatis配置文件中的标签mappers的子标签mapper的url属性

    在浏览器中输入file:/可以打开访达根目录,file:后面至少跟一个杠 MyBatis配置文件中的标签mappers的子标签mapper的url属性中file:后面至少要跟两个杠

  3. jQuery获取点击对象的父级

    一.使用$('body').on('click','.index',function(event){})绑定事件时,例: <div class="project-box"&g ...

  4. 关于Jquery获取Table中td内的内容

    $(this).children().eq(1).text()获取的是显示的值$(this).children().eq(1).html()获取的是<td></td>之间的所有 ...

  5. jquery怎么获取当前标签下的子标签

    1.var num1=$("ul > a:eq(0)").attr("ID");2.var num2=$("ul").children ...

  6. jquery 获取点击事件的id;jquery如何获取当前触发事件的控件ID值

    写html时这样绑定 <input type="text" name="address4" id="address4" onFocus ...

  7. jquery获取点击控件的绝对位置简单实例

    在使用jquery的过程中,想取得当前点击input的绝对位置而去显示一个div,jquery本身提供offset和position这个两个方法,但position官方解释是relative to t ...

  8. jquery获取li里面的第一个a标签

    $("li").children("a:eq(0)") ; children()查找子元素,eq() 查找第几个 $('.active').children(& ...

  9. jquery获取具有多个类class的标签内容

    var tag = $('div.firstClassName.secondClassName.thirdClassName'); 注意空格

随机推荐

  1. CentOS: Make Command not Found and linux xinetd 服务不能启动

    在centos 安装编译器 yum -y install gcc automake autoconf libtool make linux xinetd 服务不能启动: [root@capaa xin ...

  2. 【JMeter4.0】之 “jdk1.8、JMeter4.0” 安装与配置以及JMeter永久汉化和更改界面背景、并附加附录:个人学习总结

    目录: 一.首先,需要安装.配置jdk 二.其次,安装.配置JMeter 三.JMeter汉化以及更改界面背景 四.附录:个人学习总结 一.首先,需要安装.配置jdk   返回目录 1.到官网下载1. ...

  3. 【puppeteer+Node.js安装环境】之步骤

    步骤一:首先,安装node.js环境,从官网下载最新的安装包. 步骤二:安装完成之后,再安装npm,通过命令行输入:npm install -g cnpm --registry=https://reg ...

  4. php 如何把中文写入json中 当json文件中还显示的是中文

    /*** * 更新版本 */ function showupversionsub(){ #接受post 过来的数据 $app_type=$_POST['aap_type']; if($app_type ...

  5. linux 面试题

    [题目]一个数组,输出重复次数最多的前你n位,倒序输出 [答案]   catwords.txt | sort | uniq -c | sort -k1,1nr | head -n [解析]   sor ...

  6. 002android初级篇之ViewPager及PagerSlidingTabStrip listview的使用

    002android初级篇之ViewPager及PagerSlidingTabStrip listview的使用 ViewPager ViewPager类直接继承了ViewGroup类,所有它是一个容 ...

  7. UVA 699 The Falling Leaves (二叉树水题)

    本文纯属原创.转载请注明出处,谢谢. http://blog.csdn.net/zip_fan. Description Each year, fall in the North Central re ...

  8. Python的paramiko模块ssh操作

    SSHClient 用于连接远程服务器并执行基本命令 基于用户名密码连接: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 import paramiko    # 创建 ...

  9. 安装Hadoop 1.1.2 (三 安装配置Hadoop)

    1 tar -zxvf hadoop-1.1.2.tar.gz 2 在hadoop/conf目录 (1) 编辑 hadoop-env.sh export JAVA_HOME=/usr/java/jdk ...

  10. 实用T-SQL代码

    1.根据出生日期计算当前已满周岁 DECLARE @birth datetime SET @birth='1990-01-01' ),) ),) 2.COUNT(expression) just re ...