html按钮有两种 button,div显示,

html按钮有两种:
<input type="button" value="登录" οnclick="login()"/>
和<button οnclick="login()">登录</button>
这两种在页面上看起来好像一样没什么区别,但是这两种是有区别的。
1,如果在<form id="loginForm" name="loginForm" action="<%=path%>/hdlogin/login.action" method="post"></form>
标签中,使用<input type="button" value="登录" οnclick="login()"/>,要想提交form,
你必须写成<input type="submit" value="登录" οnclick="login()"/>,
或者document.loginForm.submit();否则form是不会提交的。
2,如果在form中使用<button οnclick="login()">登录</button>只要点击就会提交。
<button type="submit" value="登录" οnclick="login()"/>。
今天在使用<button></button>时,我又在js控制表单提交,结果这个action总是莫名其妙的走两次!
根源就是表单提交了两次,一次是<button></button>,一次是document.loginForm.submit();
这个错误很隐蔽,大家以后要注意。
//
<script>
$(function (){
$("#btn").linkbutton({
plain:false,
text:'xixihaha'
})

//点击禁用,完成禁用方法
$("#jin").click(function (){
[color=darkred] $("#btn").linkbutton('disable') [/color]
})

//点击启用,完成启用方法
$("#qi").click(function (){
[color=darkred] $("#btn").linkbutton('enable') [/color]
})
})
</script>
<a href="#" id="btn" iconCls="icon-search">easyui</a>
<a href="#" id="jin" class="easyui-linkbutton" >禁用</a>
<a href="#" id="qi" class="easyui-linkbutton">启用</a>
<!--
linkbutton的属性
id:分配给该组件的ID。
disabled:设置为true将禁用按钮。
plain:为true时不显示边框浮上去会显示边框,相反就是正常的样式,默认是false
text:按钮上显示的文字。
iconCls:用来在左边显示一个16x16大小图标的css类。

linkbutton的方法
disable:禁用按钮。
enable:启用按钮。
-->


/
$("#hide").click(function(){
$("p").hide();
});

$("#show").click(function(){
$("p").show();
});

div的visibility可以控制div的显示和隐藏,但是隐藏后页面显示空白:
  style="visibility: none;"
  document.getElementById("typediv1").style.visibility="hidden";//隐藏
  document.getElementById("typediv1").style.visibility="visible";//显示

  通过设置display属性可以使div隐藏后释放占用的页面空间,如下
  style="display: none;"
  document.getElementById("typediv1").style.display="none";//隐藏
  document.getElementById("typediv1").style.display="";//显


刷新父页面
window.parent.location.reload();/
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值