日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

onblur属性详解

發(fā)布時(shí)間:2023/12/20 编程问答 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 onblur属性详解 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

onblur 事件會(huì)在對(duì)象失去焦點(diǎn)時(shí)發(fā)生,所謂焦點(diǎn)指的就是當(dāng)前操作的對(duì)象,當(dāng)我們操作一個(gè)div時(shí),這個(gè)div就獲取了焦點(diǎn),那么onblur的作用是什么呢,在我們需要實(shí)現(xiàn)類似點(diǎn)擊其他部分取消當(dāng)前下拉框顯示的功能時(shí),onblur屬性就要開始顯現(xiàn)作用了。

下面是一個(gè)實(shí)例:

<!DOCTYPE html> <html><head><title>我的文件</title><style>body{background:#f0f0f0;}.left-button{width:100px;height:28px;font-size:13px;background: #4386f5;border-radius:3px;line-height:28px;text-align:center;margin-left:61px;margin-top:18px;color:#fff;cursor:pointer;}.show-new-content{height: 40px;margin-top: 3px;margin-left:1px;}.show-new-content-image{width:24px;height:24px;float:left;margin-top:8px;margin-left:10px;}.show-new-content-text{height: 26px;float:left;color:#000;font-size:12px;line-height:26px;margin-top:7.5px;margin-left:20px;} .show-new{width: 212px;height: 411px;display: block;background:#fff;margin-top: 3px;border: 0.1px solid #ddd;box-shadow: 1px 1px 4px #ddd;border-radius: 3px;position: absolute;display:none;}</style></head><body><div class="left-button" onclick="show('creat')" onblur="hiddendiv()" tabindex="0">新建<div id="creat" class="show-new"><div class="show-new-content"><div class="show-new-content-image"></div><div class="show-new-content-text">新建文件夾</div></div></div></div><script>var i = 0;function show(obj){document.getElementById(obj).style.display = "block";}function hiddendiv(){document.getElementById("creat").style.display = "none";}function creatDiv(){var div = document.getElementById("content");div.innerHTML += '<div class="content-div">'+'<div class="content-div-div">'+'<img class="content-div-div-img" src="https://assets.processon.com/chart_image/thumb/5b6d4053e4b053a09c2e8847.png"/>'+'</div>'+'</div>';}</script></body> </html>

?

總結(jié)

以上是生活随笔為你收集整理的onblur属性详解的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。