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.
精彩评论