string empCode = ds.Tables[0].Rows[i]["EMP_CODE"].ToString(); string empName = ds.Tables[0].Rows[i]["EMP_NAME"].ToString(); string gradeCode = ds.Tables[0].Rows[i]["GRADE_CODE"].ToString(); tr = new TableRow(); td = new TableCell(); td.Attributes.Add("onClick", "javascript: " + "if(confirm(empName)==true){self.close();}" + //this Line "else{return;}");我想在评论部分重用 empName 。有没有办法重用它?
1 回答
MMMHUHU
TA贡献1834条经验 获得超8个赞
请尝试如下所示,
td.Attributes.Add("onClick", "javascript: " +
"if(confirm(" + empName + ") === true){self.close();}" + //this Line
"else{return;}");
或尝试
td.Attributes.Add("onClick", "javascript: " +
"var empName=" + empName + "; if(confirm(empName) === true){self.close();}" + //this Line
"else{return;}");
添加回答
举报
0/150
提交
取消