62,268
社区成员
发帖
与我相关
我的任务
分享
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="CSDN.WebForm1" %>
<!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 runat="server">
<title></title>
<script src="JS/jquery-1.4.2.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$("table tr td[name=hello]").click(function () {
alert("hello world");
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr>
<td name="hello">
AA
</td>
<td>
BB
</td>
<td name="hello">
CC
</td>
</tr>
<tr>
<td name="hello">
DD
</td>
<td>
EE
</td>
<td name="hello">
FF
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>
<%@ Register Assembly="FreeTextBox" Namespace="FreeTextBoxControls" TagPrefix="FTB" %>
<!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 runat="server">
<title>无标题页</title>
<script src="jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
$("td[name='hello']").click(function() {
alert("hello world");
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<table border="1">
<tr>
<td name="hello">
1
</td>
<td>
2
</td>
<td>
3
</td>
</tr>
<tr>
<td>
1
</td>
<td name="hello">
2
</td>
<td>
3
</td>
</tr>
<tr>
<td>
1
</td>
<td>
2
</td>
<td name="hello">
3
</td>
</tr>
</table>
<table border="1">
<tr>
<td>
1
</td>
<td>
2
</td>
<td name="hello">
3
</td>
</tr>
<tr>
<td>
1
</td>
<td name="hello">
2
</td>
<td>
3
</td>
</tr>
<tr>
<td name="hello">
1
</td>
<td>
2
</td>
<td>
3
</td>
</tr>
</table>
</form>
</body>
</html>
for(int i=0;i<obj.length;i++)
if(obj.name=="hello")
obj[i].onclick = function()
{
alert("我被点!");
}