扫码关注官方订阅号
比如: <button type="button" onclick="document.getElementById('id1').style.color='red'">Click Here</button>
去掉 type="button" , 页面上的button也没啥变化啊
小伙看你根骨奇佳,潜力无限,来学PHP伐。
<input type="button"/> type浏览器一般是默认为text 而非button <button>OK</button> type可以是 button、reset、submit 不同浏览器可能默认不同,最好指定,不同于input的button的是 他内部可以放置内容,比如文本或图像。
去掉了 type="button",type 就变成默认的 "submit",区别是 type="submit" 点击以后默认会提交所在的表单,type="button" 没有默认行为。因为你要自定义行为,所以建议你还是加上。
type="button"
type
"submit"
type="submit"
<input type='button' value="点击"/> <button>点击</button>
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
扫描下载App
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
<input type="button"/> type浏览器一般是默认为text 而非button
<button>OK</button> type可以是 button、reset、submit 不同浏览器可能默认不同,最好指定,不同于input的button的是 他内部可以放置内容,比如文本或图像。
去掉了
type="button"
,type
就变成默认的"submit"
,区别是type="submit"
点击以后默认会提交所在的表单,type="button"
没有默认行为。因为你要自定义行为,所以建议你还是加上。