62,264
社区成员
发帖
与我相关
我的任务
分享
<script type="text/jscript">
var resultA=null;
var resultB=null;
//背景变色的函数 传递当前tr的index值 进行比较达到改变背景颜色.
function showmm(obj){
var gview = document.getElementById('GridView1');
for(var i=0;i<gview.rows.length;i++)
{
if(gview.rows(i).rowIndex==obj.rowIndex)
obj.style.backgroundColor='#D3E0FF';
else
gview.rows(i).style.backgroundColor='#FFFFFF';
}
resultA = obj.rowIndex;
}
document.onkeydown = function(event){
var event = window.event || event;
if(event.shiftKey){
stat=result;
alert('123');
//shift按下后执行的代码块
}
}
//测试代码函数
function fun()
{
alert(resultA);
alert(resultB);
}
</script>
/// <summary>
/// 绑定数据时触发事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void GridView_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
int rowIndex=e.Row.RowIndex;
e.Row.Attributes.Add("title", "双击行可以查看该行的明细");
e.Row.Attributes.Add("style", "CURSOR:hand;");
e.Row.Attributes.Add("onclick", "selectRow('"+rowIndex+"')");
e.Row.Attributes.Add("onclick", "selectRow('"+rowIndex+"')");
e.Row.Attributes.Add("("ondblclick ","dbClick('"+rowIndex+"'");
}
}