CS页面中的javascript无法正常工作

问题描述:

.cs

.cs

protected void  form_submit_Click(object sender, EventArgs e)
    {
        String str = "$('.txt').style.border-style=none;";
        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "chp", str.ToString(), true);
    }


.aspx


.aspx

<asp:TextBox ID="txtname" runat="server" BorderColor="#96A6C5" CssClass="txt">

('.txt').style.border-style = none;"; ScriptManager.RegisterClientScriptBlock( this this .GetType(), " ,str.ToString(), true ); }
('.txt').style.border-style=none;"; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "chp", str.ToString(), true); }


.aspx


.aspx

<asp:TextBox ID="txtname" runat="server" BorderColor="#96A6C5" CssClass="txt">


我认为您的jQuery字符串不正确.试试这个:

I don''t think your jQuery string is correct. Try this:

String str = "


('.txt').css('border-style','none');";
('.txt').css('border-style', 'none');";



另一方面,SA是正确的:您不需要也不应该.ToString()字符串.



On another matter, SA is correct: you don''t need to and shouldn''t .ToString() a string.