Deprecated: imwpcache\f884414bce24ee67f\f73723ec7b1919fa5::__construct(): Implicitly marking parameter $YECBGYFECGEAFWHA as nullable is deprecated, the explicit nullable type must be used instead in /www/wwwroot/www.chuangxiangniao.com/wp-content/plugins/imwpcache-dist/build/f884414bce24ee67ff73723ec7b1919fa5.php on line 2

Deprecated: imwpcache\f884414bce24ee67f\f73723ec7b1919fa5::__construct(): Implicitly marking parameter $BBWFDDBHHYHDXXAB as nullable is deprecated, the explicit nullable type must be used instead in /www/wwwroot/www.chuangxiangniao.com/wp-content/plugins/imwpcache-dist/build/f884414bce24ee67ff73723ec7b1919fa5.php on line 2
HTML DOM Input Reset disabled 属性 HTML DOM Input Reset disabled 属性用于设置或获取重置按钮是否被禁用_创想鸟

HTML DOM Input Reset disabled 属性 HTML DOM Input Reset disabled 属性用于设置或获取重置按钮是否被禁用

html dom input reset disabled 属性用于设置或返回重置按钮是否应该被禁用。它使用布尔值,其中 true 表示重置按钮应该被禁用,false 表示否。disabled 属性默认为 false。disabled 元素默认为灰色且不可点击。

语法

以下是 − 的语法

设置 disabled 属性 −

resetObject.autofocus = true|false

Here, true=reset button is disabled and false=the reset button is not disabled. It is false by default.

Example

Let us look at an example for the Input reset disabled property −

立即学习“前端免费学习笔记(深入)”;

 Live Demo

Input reset disabled Property

UserName:
Location:

Disable the above reset button by clicking on the DISABLE button

音疯
音疯

音疯是昆仑万维推出的一个AI音乐创作平台,每日可以免费生成6首歌曲。

音疯 178
查看详情 音疯

function disableReset() { document.getElementById("RESET1").disabled=true; document.getElementById("Sample").innerHTML = "The reset button is now disabled" ; }

输出

这将产生以下输出 −

HTML DOM Input Reset disabled 属性HTML DOM Input Reset disabled 属性用于设置或获取重置按钮是否被禁用

点击“DISABLE”按钮 −

HTML DOM Input Reset disabled 属性HTML DOM Input Reset disabled 属性用于设置或获取重置按钮是否被禁用

在上面的例子中 −

我们创建了一个type=”reset”,id=”RESET1”的元素。点击此按钮将重置表单数据。此按钮位于包含两个文本字段的表单中,该表单还应用了内联样式 −

UserName:  
Location:

然后我们创建了一个名为DISABLE的按钮,当用户点击时将执行disableReset()方法 −

disableReset() 方法使用 getElementById() 方法获取类型为 reset 的输入元素,并将其 disabled 属性设置为 true。这使得重置按钮无法点击,用户无法再与其进行交互。它现在变成了灰色 −

function disableReset() {   document.getElementById("RESET1").disabled=true;   document.getElementById("Sample").innerHTML = "The reset button is now disabled" ;}

以上就是HTML DOM Input Reset disabled 属性HTML DOM Input Reset disabled 属性用于设置或获取重置按钮是否被禁用的详细内容,更多请关注创想鸟其它相关文章!

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/1551048.html

赞 (0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
为Bootstrap按钮添加尺寸
上一篇 2025年12月21日 21:16:09
HTML DOM Input Password autofocus 属性
下一篇 2025年12月21日 21:16:19

相关推荐

发表回复

登录后才能评论
关注微信