zoukankan
html css js c++ java
JQuery实现表格隔行换色,鼠标移动变色,点击选择变色
Code
<%
@ Page Language
=
"
C#
"
AutoEventWireup
=
"
true
"
Codebehind
=
"
WebForm1.aspx.cs
"
Inherits
=
"
WebApplication14.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 language
=
"
javascript
"
type
=
"
text/javascript
"
src
=
"
jquery.js
"
></
script
>
<
script language
=
"
javascript
"
type
=
"
text/javascript
"
>
var color;
$(document).ready(function()
{
$(
"
#GridView1 tr
"
).attr(
"
selected
"
,
"
0
"
);
$(
"
#GridView1 tr:even
"
).not(
"
:first
"
).css(
"
background
"
,
"
red
"
);
$(
"
#GridView1 tr:odd
"
).css(
"
background
"
,
"
yellow
"
);
$(
"
#GridView1 tr
"
).not(
"
:first
"
).click(function()
{
$(
"
#GridView1 tr:even
"
).not(
"
:first
"
).css(
"
background
"
,
"
red
"
);
$(
"
#GridView1 tr:odd
"
).css(
"
background
"
,
"
yellow
"
);
var selected
=
$(
this
).attr(
"
selected
"
);
if
(selected
==
1
)
{
$(
this
).attr(
"
selected
"
,
"
0
"
);
color
=
$(
this
).css(
"
background
"
);
}
else
{
$(
"
#GridView1 tr
"
).attr(
"
selected
"
,
"
0
"
);
$(
this
).attr(
"
selected
"
,
"
1
"
);
$(
this
).css(
"
background
"
,
"
green
"
);
color
=
$(
this
).css(
"
background
"
);
}
}
).mouseover(function()
{
color
=
$(
this
).css(
"
background
"
);
$(
this
).css(
"
background
"
,
"
green
"
);
}
).mouseout(function()
{
$(
this
).css(
"
background
"
,color);
}
);
}
);
</
script
>
</
head
>
<
body
>
<
form id
=
"
form1
"
runat
=
"
server
"
>
<
div
>
&
nbsp;
<
asp:TextBox ID
=
"
TextBox1
"
runat
=
"
server
"
></
asp:TextBox
>
<
asp:Button ID
=
"
Button2
"
runat
=
"
server
"
Text
=
"
Button
"
/>&
nbsp;
<
br
/>
<
br
/>
<
br
/>
<
asp:Button ID
=
"
Button1
"
runat
=
"
server
"
Text
=
"
Button
"
/><
asp:GridView ID
=
"
GridView1
"
runat
=
"
server
"
AutoGenerateColumns
=
"
False
"
DataSourceID
=
"
SqlDataSource1
"
EmptyDataText
=
"
没有可显示的数据记录。
"
>
<
Columns
>
<
asp:BoundField DataField
=
"
User_id
"
HeaderText
=
"
User_id
"
SortExpression
=
"
User_id
"
/>
<
asp:BoundField DataField
=
"
User_name
"
HeaderText
=
"
User_name
"
SortExpression
=
"
User_name
"
/>
<
asp:BoundField DataField
=
"
User_max_borrow
"
HeaderText
=
"
User_max_borrow
"
SortExpression
=
"
User_max_borrow
"
/>
</
Columns
>
</
asp:GridView
>
<
asp:SqlDataSource ID
=
"
SqlDataSource1
"
runat
=
"
server
"
ConnectionString
=
"
<%$ ConnectionStrings:QIConnectionString1 %>
"
ProviderName
=
"
<%$ ConnectionStrings:QIConnectionString1.ProviderName %>
"
SelectCommand
=
"
SELECT [User_id], [User_name], [User_max_borrow] FROM [Book_user]
"
>
</
asp:SqlDataSource
>
</
div
>
</
form
>
</
body
>
</
html
>
qishichang
查看全文
相关阅读:
解决Ubuntu下博通网卡驱动问题
泛型的使用
Http常见的响应头
URL
Tomcat目录结构
Tomcat常见启动问题
J2EE的13种核心技术
css中相对定位和绝对定位
Link标签
html基本结构
原文地址:https://www.cnblogs.com/qishichang/p/1339328.html
最新文章
PAT 1001. A+B Format(水题)
ps查看图层大小快捷键
mysql 排序规则
linux 指定tomcat的具体路径
Linux 远程登录命令telnet
Linux 查看端口状态netstat
Linux 文件复制命令cp
Linux 常用解压和压缩命令
linux 配置多个tomcat
Linux 删除命令rm
热门文章
Linux 文件或文件夹重命名命令mv
linux下/etc/hosts 和hostname文件的区别
CentOS6.x修改主机名,关闭防火墙
CentOS6X安装PHP5.5
CentOS安装自动补全安装包
手动安装minGW
printf函数对参数的计算顺序
ubuntu:好用的help命令
ubuntu修改主机名
SS不能在Win7中打开,出现停止运行
Copyright © 2011-2022 走看看