CS页面中的javascript无法正常工作 [英] javascript in cs page is not working correctly

查看:85
本文介绍了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.


这篇关于CS页面中的javascript无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆