我创建了函数,它会在.net 中添加评论时显示类似 twitter 的消息,当从 aspx 文件调用 javascript 函数时一切正常,但是当尝试在页面上注册它时它不起作用?
vb 中的函数:
Dim script As String = ""
script &= " function ErrorMessage121212(TextClass, Error, MainDiv) { "
script &= " MainDiv = '#' + MainDiv;"
script &= " $(MainDiv).append(""<div align='center' id='overlaytext' style='margin-top:10px'></div>"");"
script &= " $(MainDiv).css('color', 'white');"
script &= " $(MainDiv).css('align', 'center');"
script &= " $(MainDiv).css('backgroundColor', 'black');"
script &= " $(MainDiv).css('display', ""none"");"
script &= " $('#overlaytext').html(""<b>"" + Error + ""</b>"");"
script &= " if (TextClass == """") {"
script &= " }"
script &= " else { "
script &= " $('#overlaytext').addClass(TextClass);"
script &= " }"
script &= " $(MainDiv).fadeIn(1000, function () { $(MainDiv).fadeOut(1000); })"
script &= " }"
script &= " ErrorMessage121212('" & MessageCss & "','" & errormessage & "','" & DivID & "');"
If Not Page.ClientScript.IsClientScriptBlockRegistered("s1") Then
Page.ClientScript.RegisterClientScriptBlock(_page.GetType(), "s1", script)
End If
Return True