开发者

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

开发者 https://www.devze.com 2023-01-22 22:14 出处:网络
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 th

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

精彩评论

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