admin管理员组文章数量:1421921
I am Working in ASP.NET and C#.
In my Application i have a registration form in which there is a label which shows the success and failure of the registration.The text for that label is from codebehind based on the condition.Now what i need is to hide the label after sometime (say 5sec) on clicking the submit button.I have tried this using javascript but its not working properly.please let me know whats the mistake or give ur sugessions.
Script:
function HideLabel() {
document.getElementById('<%= lbl1.ClientID %>').style.display = "none";
}
setTimeout("HideLabel();", 5000);
I am Working in ASP.NET and C#.
In my Application i have a registration form in which there is a label which shows the success and failure of the registration.The text for that label is from codebehind based on the condition.Now what i need is to hide the label after sometime (say 5sec) on clicking the submit button.I have tried this using javascript but its not working properly.please let me know whats the mistake or give ur sugessions.
Script:
function HideLabel() {
document.getElementById('<%= lbl1.ClientID %>').style.display = "none";
}
setTimeout("HideLabel();", 5000);
Share
Improve this question
asked Jan 31, 2013 at 6:09
codercoder
2,0203 gold badges22 silver badges32 bronze badges
2
- do you mind using jquery?. You can add fadeIN and fade out – Konza Commented Jan 31, 2013 at 6:12
- developer.mozilla/en-US/docs/DOM/window.setTimeout – Iswanto San Commented Jan 31, 2013 at 6:13
1 Answer
Reset to default 7You have wrong syntax of setTimout. You have to pass name of function, remove the quotes and also pass name not call the function. One more thing to take care is to put the code just before the closing body
tag to ensure the availability of html elements.
Change
setTimeout("HideLabel();", 5000);
To
setTimeout(HideLabel, 5000);
本文标签: javascripthide a label after some time automatically after a buttonclickStack Overflow
版权声明:本文标题:javascript - hide a label after some time automatically after a buttonclick - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745360333a2655264.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论