我的页面使用javascript时老是报未结束字符串常量的错误。
((Label)e.Row.FindControl("Label3")).Text = "<a href='#' onmousemove=Show('"+name+"','"+userType+"','"+address+"','"+regtime+"','"+stustatus+"','"+schoolName+"') onmouseout=Hide()>" + name + "</a>";可能是这串代码引起的,但具体错在哪里我不知道。麻烦各位大侠能不能帮我看看?

解决方案 »

  1.   

    Label lb = (Label)e.Row.FindControl("Label3");
    lb.Text = "<a href='#' onmousemove=Show('"+name+"','"+userType+"','"+address+"','"+regtime+"','"+stustatus+"','"+schoolName+"') onmouseout=Hide()>" + name + "</a>";这样试试
      

  2.   

    asp.net  你要向页面动态增加JS脚本 
    1 可以使用RegisterStartupScript在页面用JS给Label动态绑定事件
    2 也可以使用Label.addAttrbute("onmouseover",方法内容)
      

  3.   

    Show是否少了个)符号,反正我没有看到有
      

  4.   

    show有“)”的。在onmouseout前面
      

  5.   

    使用literal
    "<a href='#' onmousemove=\"Show('"+name+"','"+userType+"','"+address+"','"+regtime+"','"+stustatus+"','"+schoolName+"')\" onmouseout=\"Hide()\">" + name + "</a>";