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

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

onblur属性详解

發布時間:2023/12/20 编程问答 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 onblur属性详解 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

onblur 事件會在對象失去焦點時發生,所謂焦點指的就是當前操作的對象,當我們操作一個div時,這個div就獲取了焦點,那么onblur的作用是什么呢,在我們需要實現類似點擊其他部分取消當前下拉框顯示的功能時,onblur屬性就要開始顯現作用了。

下面是一個實例:

<!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>

?

總結

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

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。