我的页面使用javascript时老是报未结束字符串常量的错误。
((Label)e.Row.FindControl("Label3")).Text = "<a href='#' onmousemove=Show('"+name+"','"+userType+"','"+address+"','"+regtime+"','"+stustatus+"','"+schoolName+"') onmouseout=Hide()>" + name + "</a>";可能是这串代码引起的,但具体错在哪里我不知道。麻烦各位大侠能不能帮我看看?
((Label)e.Row.FindControl("Label3")).Text = "<a href='#' onmousemove=Show('"+name+"','"+userType+"','"+address+"','"+regtime+"','"+stustatus+"','"+schoolName+"') onmouseout=Hide()>" + name + "</a>";可能是这串代码引起的,但具体错在哪里我不知道。麻烦各位大侠能不能帮我看看?
lb.Text = "<a href='#' onmousemove=Show('"+name+"','"+userType+"','"+address+"','"+regtime+"','"+stustatus+"','"+schoolName+"') onmouseout=Hide()>" + name + "</a>";这样试试
1 可以使用RegisterStartupScript在页面用JS给Label动态绑定事件
2 也可以使用Label.addAttrbute("onmouseover",方法内容)
"<a href='#' onmousemove=\"Show('"+name+"','"+userType+"','"+address+"','"+regtime+"','"+stustatus+"','"+schoolName+"')\" onmouseout=\"Hide()\">" + name + "</a>";