读书人

旧话重提怎么在Command_Click前用JS

发布时间: 2012-02-26 20:19:45 作者: rapoo

旧话重提,如何在Command_Click前用JS检测检测是否为空?为空,则不执行。
如上题。

[解决办法]
为你的button加上onclick事件

<input id= "txtValue " type= "text " />
<asp:button id= "btnSubmit " Text= "Submit "
OnClientClick= "if (document.getElementById( 'txtValue ').value != ' ') return true; else return false; " />
[解决办法]
UseSubmitBehavior = "false "
[解决办法]
OnClientClick= "if (document.getElementById( 'txtValue ').value != ' ') return true; else return false; "
------------------

function check()
{
if (document.getElementById( 'txtValue ').value != ' ') return true; else return false;
}
OnClientClick= "return check() "

读书人网 >asp.net

热点推荐