您的位置 首页 技术专栏

html5中onclick是什么意思

24小时课堂在线收录html5中onclick是什么意思,html5中oncpck的意思是“单击”,oncpck属性是鼠标事件的一种,在单击鼠标时触发,用于规定事件触发时执行的脚本,语法为“<ele…感谢您关注html5中onclick是什么意思。

html5中oncpck的意思是“单击”,oncpck属性是鼠标事件的一种,在单击鼠标时触发,用于规定事件触发时执行的脚本,语法为“<element oncpck=”script”>”。

本教程操作环境:windows10系统、HTML5版、Dell G3电脑。

html5中oncpck是什么意思

oncpck是HTML标记对象的一个属性。

oncpck属性是鼠标事件的一种,在单击鼠标时触发。

oncpck 属性不能应用于以下元素:<base>, <bdo>, <br>, <head>, <html>, <iframe>, <meta>, <param>, <script>, <style>, 或<title>。

语法如下:

<element oncpck=”script”>

其中script表示规定该oncpck事件触发时执行的脚本。

示例如下:

<html><head><meta charset=”utf-8″> <title>123</title><script>function copyText(){document.getElementById(“field2”).value=document.getElementById(“field1″).value;}</script></head><body>字段1: <input type=”text” id=”field1″ value=”Hello World!”><br>字段2: <input type=”text” id=”field2″><br><br><button oncpck=”copyText()”>复制文本</button><p>在按钮点击时触发函数。函数将字段1的文字信息复制到字段2。</p></body></html>

输出结果:

html5中onclick是什么意思

推荐教程:《html视频教程》

以上就是html5中oncpck是什么意思的详细内容,更多请关注24小时课堂在线其它相关文章!

本文来自网络,不代表24小时课堂在线立场,转载请注明出处:https://www.24ketang.cn/100235.html

为您推荐

返回顶部