开发者

Please modify the code, it gives error that functionRemainCount() does not exist in current context?

I have taken function "functionRemainCount()" in .js page. I want to call inside the .aspx page . I have used code like this but it gives error that function name does not exit in current context tha开发者_高级运维t correct because it is used in .js file. So how to call the function? Please tell me.

My code is this:

protected void Page_Load(object sender, EventArgs e)
{
    txtNote.Attributes.Add("OnKeyDown", functionRemainCount());
            txtNote.Attributes.Add("OnKeyUp", functionRemainCount ());
} 


Try:

txtNote.Attributes.Add("OnKeyDown", "functionRemainCount()"); 
txtNote.Attributes.Add("OnKeyUp", "functionRemainCount()"); 


Attributes.Add() takes two string parameters.

txtNote.Attributes.Add("OnKeyDown", "functionRemainCount()");

in this case you need to provide a string of actual javascript code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜