在DataGrid中,當Mouse移到數據行上時怎樣讓其高亮顯示,並且當Mouse按下時讓其被選定!謝謝
解决方案 »
- js 图片放大 背景置会
- asp.net通讯,工作需要十万火急,大家多多帮助谢谢
- 如何在asp.net中弹出一个提示框,当单击“是” 执行一个操作,当单击“否”执行另一个操作
- 如何上传跨服务器文件
- sql2000一个小问题
- 再提问:用COOKIE保存一天 保存一月 怎么写?
- 页面如何无刷新传值?
- ASP.net程序读取客户端XML文件问题,一定给分!
- 邮件系统问题?
- asp.net中点击一个按钮然后在GridView中新添加一行(可输入值的)
- 将一内网网站发布到公网,数据库连接串里的数据库地址该写公网地址还是内网地址啊?
- 为什么我在后台编码 DongTai.aspx.cs文件中实例化不了己写好的类呢?
{
if(e.Item.ItemIndex>=0)
{
e.Item.Attributes.Add("onmouseover","color=this.style.backgroundColor;this.style.backgroundColor='#00ccff'");
e.Item.Attributes.Add("onmouseout","this.style.backgroundColor=color");
}
}
<head>
<script language="JavaScript" src="">
function a(){
var obj=window.event.srcElement;
if(obj.tagName=="TD")
obj.style.backgroundColor="#FFFFCC";
}
function b(){
var obj=window.event.srcElement;
if(obj.tagName=="TD")
obj.style.backgroundColor="";
}
</script>
</head>__________________
private void Page_Load(object sender, System.EventArgs e)
{
this.dataGrid1.Attributes.Add("onmouseover", "a();");
this.dataGrid1.Attributes.Add("onmouseout", "b();");
}
<script language="JavaScript" src="">
function a(){
var obj=window.event.srcElement;
if(obj.tagName=="TD")
obj.style.backgroundColor="#FFFFCC";
}
function b(){
var obj=window.event.srcElement;
if(obj.tagName=="TD")
obj.style.backgroundColor="";
}
</script> <table onmouseover="a();" onmouseout="b();" width="500" cellspacing=0>
<tr>
<td height="20" align="center" bgcolor="#EEEEEE">
</td>
</tr>
<tr>
<td height="20" align="center" bgcolor="#EEEEEE">
</td>
</tr>
<tr>
<td height="20" align="center" bgcolor="#EEEEEE">
</td>
</tr>
<tr>
<td height="20" align="center" bgcolor="#EEEEEE">
</td>
</tr>
<tr>
<td height="20" align="center" bgcolor="#EEEEEE">
</td>
</tr>
<tr>
<td height="20" align="center" bgcolor="#EEEEEE">
</td>
</tr>
</table>
If e.Item.Cells(0).Text <> "COE_ID" Then
Dim Url_Para As String = "clientid=" + GetParameter.GetParameter(mPara, "clientid") + "&eventid=" + e.Item.Cells(0).Text
Url_Para = GetParameter.CodingString(Url_Para)
Dim rowID As String = "ip_coe_" & e.Item.Cells(0).Text & Int(100 * Rnd())
e.Item.Attributes.Add("id", "ID_" + e.Item.Cells(0).Text)
e.Item.Attributes.Add("onMousedown", "javascript:onfocuscolor(this,'" + e.Item.Cells(0).Text + "','" + rowID + "');")
e.Item.Cells(2).Text = "<A id='" + rowID + "' target='ip_coe_" + e.Item.Cells(0).Text + "' href='ip_coe_detail.aspx?Para=" + Url_Para + "'>" + e.Item.Cells(2).Text + "</A>"
If IsDate(e.Item.Cells(4).Text) Then
If CDate(e.Item.Cells(4).Text) < Now.Date Then
e.Item.Attributes.Add("style", "BACKGROUND-COLOR: inactiveborder")
End If
End If
End If e.Item.Attributes.Add("style", "cursor: default")
End Sub
var oldid="";
var selid="";
function onfocuscolor(line, eventid,rowID)
{
if (oldid == line){
line.style.backgroundColor = "#ffffff";
line.style.color = "#003399";
oldid = "";
selid = "";
document.Form1.coeid.value=selid;
document.Form1.RowID.value="";
}else{
if (oldid==""){
line.style.backgroundColor = "#009999";
line.style.color = "#CCFF99";
oldid = line;
selid = eventid;
document.Form1.coeid.value=selid;
document.Form1.RowID.value=rowID;
}else{
line.style.backgroundColor = "#009999";
line.style.color = "#CCFF99";
oldid.style.backgroundColor = "#ffffff";
oldid.style.color = "#003399";
oldid = line;
selid = eventid;
document.Form1.coeid.value=selid;
document.Form1.RowID.value=rowID;
}
}
}