struts通过javascript使按钮变灰为不可用,灰色按钮

struts页面用javascript来实现使按钮的变灰

Html代码 复制代码   收藏代码
  1. < html:form   action = "12.do"   method = "post" >   
  2. < html:button   property = "bb"   onclick = "test();" > 退出 </ html:button >   
  3. </ html:form >   
  4.   
  5. < script   language = "javascript"   type = "text/javascript" >   
  6. function test()   
  7. {      
  8.  document.forms[0] .bb.disabled    =    true    ;      
  9. }   
  10. </ script >   
<html:form action="12.do" method="post">
<html:button property="bb" onclick="test();">退出</html:button>
</html:form>

<script language="javascript" type="text/javascript">
function test()
{   
 document.forms[0].bb.disabled   =   true   ;   
}
</script>

 按下这个按钮,他自己就变成灰色且不可点的了

猜你喜欢

转载自xiaoxuejie.iteye.com/blog/1131617