I created Function which will show message like twitter when adding comments in .net
every things are ok when call the javascript function from aspx file but when try to register it on the page it not worked ?
the function in 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
Try the below code its working fine : –