標籤中使用該屬性。範例您可以嘗試執行以下程式碼來使用accept屬性:       FileUploadBox</title"/><meta property="og:local" content="zh-tw"> <meta property="og:title" content="HTML檔案輸入控制項的capture和accept屬性無法正常運作-html教學-PHP中文網"> <meta property="og:description" content="使用accept屬性在HTML中設定伺服器接受的檔案類型。只能在<inputtype="file">標籤中使用該屬性。範例您可以嘗試執行以下程式碼來使用accept屬性:<!DOCTYPEhtml><html>  <head>     <title>FileUploadBox</title"> <meta property="og:url" content="https://m.php.cn/zh-tw/faq/603305.html"> <meta property="og:image" content="https://img.php.cn/upload/article/000/000/164/169398150539749.jpg"> <meta property="og:site_name" content="php.cn"> <meta property="og:type" content="website"> <link rel="canonical" href="https://www.php.cn/zh-tw/faq/603305.html"/> <link rel="alternate" hrefLang="zh-cn" href="https://m.php.cn/zh/faq/603305.html" /> <link rel="alternate" hrefLang="en" href="https://m.php.cn/faq/603305.html" /> <link rel="alternate" hrefLang="zh-tw" href="https://m.php.cn/zh-tw/faq/603305.html" /> <link rel="alternate" hrefLang="ja" href="https://m.php.cn/ja/faq/603305.html" /> <link rel="alternate" hrefLang="ko" href="https://m.php.cn/ko/faq/603305.html" /> <link rel="alternate" hrefLang="ms" href="https://m.php.cn/ms/faq/603305.html" /> <link rel="alternate" hrefLang="fr" href="https://m.php.cn/fr/faq/603305.html" /> <link rel="alternate" hrefLang="de" href="https://m.php.cn/de/faq/603305.html" /> <meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5, user-scalable=1" /><meta name="applicable-device" content="mobile" /><link rel="stylesheet" href="/static/css/style.css?4.5.31"><link href="/static/front/mobcss/newphpcommon.css?1.1" type="text/css" rel="stylesheet"/><link href="/static/front/mobcss/swiper.min.css" type="text/css" rel="stylesheet"/><link href="/static/front/mobcss/newphp.css?1.2" type="text/css" rel="stylesheet"/><link href="/static/css/global.css" type="text/css" rel="stylesheet"/><link href="/static/layui/css/layui.css" type="text/css" rel="stylesheet"/><link href="/static/mobcss/mobindex3.css" type="text/css" rel="stylesheet"/><script src="/static/front/mobjs/jquery-1.6.1.min.js"></script><script src="/static/front/mobjs/swiper.min.js"></script><script src="/static/front/mobjs/newphpcommon.js"></script><link rel="canonical" href="https://www.php.cn/zh-tw/faq/603305.html"/> <link rel="alternate" hrefLang="zh-cn" href="https://m.php.cn/zh/faq/603305.html" /> <link rel="alternate" hrefLang="en" href="https://m.php.cn/faq/603305.html" /> <link rel="alternate" hrefLang="zh-tw" href="https://m.php.cn/zh-tw/faq/603305.html" /> <link rel="alternate" hrefLang="ja" href="https://m.php.cn/ja/faq/603305.html" /> <link rel="alternate" hrefLang="ko" href="https://m.php.cn/ko/faq/603305.html" /> <link rel="alternate" hrefLang="ms" href="https://m.php.cn/ms/faq/603305.html" /> <link rel="alternate" hrefLang="fr" href="https://m.php.cn/fr/faq/603305.html" /> <link rel="alternate" hrefLang="de" href="https://m.php.cn/de/faq/603305.html" /> <script> var canshu = { SeeMore:'看更多', FoldUp:'折起來', Choice:'語言', wait:'正在加載,請稍候~', LoginFirst:"請先登入", needKeyword:'輸入關鍵字搜尋', emailPhoneError:'請輸入正確的電話或電子郵件地址', missPwd:'請輸入密碼', emailError:'請輸入您正確的電子郵件地址', VerCode:"請輸入驗證碼", getCode:'傳送', pwdError:'密碼格式不正確', TwoPassNotMatch:'兩個密碼不匹配', Bindemail:'綁定信箱', resetpassword:'重新設密碼', ConfirmPass:'確認密碼', pwdCheck:'請輸入6-18個字母或數字', Editinfor: '編輯個人資訊', trimContent:'請輸入內容', titleCheck:'標題長度應至少為 5 個字', choiceLang:'請選擇語言分類', Secondreply:'回覆', NetWorkError:'網路錯誤,請稍後重試!', keywordSearch:'輸入關鍵字搜尋', all_lang_string:'zh|en|zh-tw|ja|ko|ms|fr|de', Next:'下一頁', Previous:'上一頁' }; </script><!-- Google Tag Manager --><script> (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl; f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-WWVXRJPW'); </script><!-- End Google Tag Manager --><!-- Google tag (gtag.js) --><script async src="https://www.googletagmanager.com/gtag/js?id=G-H42EVCYBJC"></script><script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-H42EVCYBJC'); </script><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5902227090019525" crossorigin="anonymous"></script><!--<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-6267705206177514" crossorigin="anonymous"></script>--><script type="application/ld+json">{"@context":"https:\/\/schema.org","@type":"WebSite","url":"https:\/\/m.php.cn\/zh-tw\/","potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/m.php.cn\/zh-tw\/search?word={search_term_string}"},"query-input":"required name=search_term_string"}}</script><meta property="article:author" content="PHPz" /><meta property="article:published_first" content="tutorialspoint,https://www.tutorialspoint.com/HTML-file-input-control-with-capture-and-accept-attributes-is-not-working-correctly" /><link rel="stylesheet" href="/static/ueditor/third-party/SyntaxHighlighter/shCoreDefault.css?1"><link rel="stylesheet" href="/static/ueditor/third-party/SyntaxHighlighter/shCoreDefault1.css"><link href="/static/mobcss/newphp.css" type="text/css" rel="stylesheet"/><script src="/static/ueditor/third-party/SyntaxHighlighter/shCore.js"></script><script type="text/javascript" src="/static/layui/layui.js"></script><script type="text/javascript" src="/static/js/global.js?4.9.47"></script><script> var xnb_name = 'Virtual currency'; </script><script type="application/ld+json">{"@context":"https:\/\/schema.org","@type":"Article","headline":"HTML檔案輸入控制項的capture和accept屬性無法正常運作","description":"使用accept屬性在HTML中設定伺服器接受的檔案類型。只能在<inputtype=\"file\">標籤中使用該屬性。範例您可以嘗試執行以下程式碼來使用accept屬性:<!DOCTYPEhtml><html>  <head>     <title>FileUploadBox<\/title","image":["https:\/\/img.php.cn\/upload\/article\/000\/000\/164\/169398150582933.jpg?x-oss-process=image\/resize,p_40"],"datePublished":"2023-09-06T14:25:03+8:00","author":{"url":"https:\/\/m.php.cn\/zh-tw\/member\/164.html","name":"PHPz"},"mainEntityOfPage":{"@type":"WebPage","@id":"https:\/\/m.php.cn\/zh-tw\/faq\/603305.html"},"url":"https:\/\/m.php.cn\/zh-tw\/faq\/603305.html","articleBody":"<p><img src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/164\/169398150582933.jpg?x-oss-process=image\/resize,p_40\" alt=\"HTML檔案輸入控制項的capture和accept屬性無法正常運作\"><\/p>\n<p>使用<em>accept<\/em>屬性在HTML中設定伺服器接受的檔案類型。只能在<input type=\"file\">標籤中使用該屬性。 <\/p>\n<h2>範例<\/h2>\n<p>您可以嘗試執行以下程式碼來使用accept屬性:<\/p><pre class='brush:php;toolbar:false;'><!DOCTYPE html>\n<html>\n   <head>      \n   <title>File Upload Box<\/title>    \n   <\/head>\n   <body>\n      <form>    \n         <input type = \"file\" name = \"fileupload\" accept = \"image\/*\" \/>  \n      <\/form>\n   <\/body>\n<\/html><\/pre><p>capture 屬性是一個布林屬性,如果指定,則表示首選直接從裝置擷取媒體. ..。 <\/p>\n<p>capture 屬性不用於將相機選項包含在對話框,但表示首選從網路攝影機直接捕獲。 <\/p>\n<p>下面給出「正確」程式碼<\/p><pre class='brush:php;toolbar:false;'><input type = \"file\" accept = \"image\/*\"><\/pre>"}</script><script type="application/ld+json">{"@context":"https:\/\/schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"item":{"@id":"https:\/\/m.php.cn\/zh-tw\/","name":"首頁"}},{"@type":"ListItem","position":2,"item":{"@id":"https:\/\/m.php.cn\/zh-tw\/web-designer.html","name":"web前端"}},{"@type":"ListItem","position":3,"item":{"@id":"https:\/\/m.php.cn\/zh-tw\/div-tutorial.html","name":"html教學"}},{"@type":"ListItem","position":4,"item":{"@id":"https:\/\/m.php.cn\/zh-tw\/faq\/603305.html","name":"HTML檔案輸入控制項的capture和accept屬性無法正常運作"}}]}</script></head><body data-commit-time="2023-12-28T14:50:12+08:00" class="body2_2"><link rel="stylesheet" type="text/css" href="/static/csshwm/m_stylehw.css"><header><div class="head"><div class="haed_left"><div class="haed_logo"><a href="https://m.php.cn/zh-tw/" title="PHP中文網" class="haed_logo_a"><img src="/static/imghwm/logo.png" alt="PHP中文網" class="haed_logoimg"></a></div></div><div class="search_div search_div_top2"><input id="key_words" class="search-input" type="text" autocomplete="off" name="keywords" required="required" placeholder="Block,address,transaction,news" value="" onkeydown="if (event.keyCode == 13) searchs('zh-tw')"/><a onclick="searchs('zh-tw')" href="javascript:;" title="搜尋"><img onerror="this.onerror=''; this.src='static/imghwm/default1.png'" src="/static/imghwm/find.png" alt="搜尋"></a></div><div class="head_right"><button type="button" class="layui-btn layui-btn-primary headerlan headlanmax lan1" id="lan1sp" lay-on="test-offset-r"><img src="/static/imghwm/m_menu.png" alt=""></button><div id="m_menu" class="m_menu" style="display: none;"><div class="m_editormain12main_top"><img src="/static/imghwm/logo.png" alt="logo"><a href="javascript:;" class="m_editormain12main_topi" id="m_editormain12main_topi_sp"><i class="layui-icon layui-icon-close"></i></a></div><div class="layui-panel m_menu_main"><ul class="layui-menu" id="demo-menu"><li class="layui-menu-item-group layui-menu-item-up m_menus" lay-options="{type: 'group'}"><div class="layui-menu-body-title m_menus_title">社群<i class="layui-icon layui-icon-down"></i></div><ul class="m_menusnames"><li><div class="layui-menu-body-title m_menus_name"><a href="https://m.php.cn/zh-tw/article.html" title="文章">文章</a></div></li><li><div class="layui-menu-body-title m_menus_name"><a href="https://m.php.cn/zh-tw/faq/zt" title="合集">合集</a></div></li><li><div class="layui-menu-body-title m_menus_name"><a href="https://m.php.cn/zh-tw/wenda.html" title="問答">問答</a></div></li></ul></li><li class="layui-menu-item-divider"></li><li class="layui-menu-item-group layui-menu-item-up m_menus" lay-options="{type: 'group'}"><div class="layui-menu-body-title m_menus_title">學習<i class="layui-icon layui-icon-down"></i></div><ul class="m_menusnames"><li><div class="layui-menu-body-title m_menus_name"><a href="https://m.php.cn/zh-tw/course.html" title="課程">課程</a></div></li><li><div class="layui-menu-body-title m_menus_name"><a href="https://m.php.cn/zh-tw/dic/29.html" title="程式設計字典">程式設計字典</a></div></li></ul></li><li class="layui-menu-item-divider"></li><li class="layui-menu-item-group layui-menu-item-up m_menus" lay-options="{type: 'group'}"><div class="layui-menu-body-title m_menus_title">工具庫<i class="layui-icon layui-icon-down"></i></div><ul class="m_menusnames"><li><div class="layui-menu-body-title m_menus_name"><a href="https://m.php.cn/zh-tw/toolset/development-tools" title="開發工具">開發工具</a></div></li><li><div class="layui-menu-body-title m_menus_name"><a href="https://m.php.cn/zh-tw/toolset/website-source-code" title="網站源碼">網站源碼</a></div></li><li><div class="layui-menu-body-title m_menus_name"><a href="https://m.php.cn/zh-tw/toolset/php-libraries" title="PHP 函式庫">PHP 函式庫</a></div></li><li><div class="layui-menu-body-title m_menus_name"><a href="https://m.php.cn/zh-tw/toolset/js-special-effects" title="JS特效">JS特效</a></div></li><li><div class="layui-menu-body-title m_menus_name"><a href="https://m.php.cn/zh-tw/toolset/website-materials" title="網站素材">網站素材</a></div></li><li><div class="layui-menu-body-title m_menus_name"><a href="https://m.php.cn/zh-tw/toolset/extension-plug-ins" title="擴充插件">擴充插件</a></div></li></ul></li><li class="layui-menu-item-divider"></li><li lay-options="{id: 100}"><div class="layui-menu-body-title m_menus_oth"><a href="https://m.php.cn/zh-tw/ai" title="AI工具">AI工具</a></div></li><li class="layui-menu-item-divider"></li><li class="layui-menu-item-group layui-menu-item-up m_menus" lay-options="{type: 'group'}"><div class="layui-menu-body-title m_menus_title">休閒<i class="layui-icon layui-icon-down"></i></div><ul class="m_menusnames"><li><div class="layui-menu-body-title m_menus_name"><a href="https://m.php.cn/zh-tw/game" title="遊戲下載">遊戲下載</a></div></li><li><div class="layui-menu-body-title m_menus_name"><a href="https://m.php.cn/zh-tw/mobile-game-tutorial/" title="遊戲教程">遊戲教程</a></div></li></ul></li><li class="layui-menu-item-divider"></li></ul></div><!-- <div class="m_menu_button">--><!-- <a href="javascript:;" title="singup">Create an account</a>--><!-- </div>--><div class="m_menu_button m_menu_button_login"><a href="https://m.php.cn/zh-tw/login" title="Login">Log in</a></div><div class="m_menu_button m_menu_button_lang"><button type="button" class="layui-btn layui-btn-primary headerlan headlanmax lan1" id="lan1" lay-on="page2">繁体中文<i class="layui-icon layui-icon-triangle-d"></i></button></div></div><div class="m_menu_lang" id="m_menu_lang" style="display: none;"><div class="m_editormain12main_top"><img src="/static/imghwm/logo.png" alt="logo"><a href="javascript:;" class="m_editormain12main_topi" id="m_editormain12main_topi_lan"><i class="layui-icon layui-icon-close"></i></a></div><div class="m_menu_lang_main"><a href="javascript:setlang('zh-cn');" class="m_menu_lang_mains">简体中文<span>zh-cn</span></a><a href="javascript:setlang('en');" class="m_menu_lang_mains">English<span>en</span></a><a href="javascript:;" class="m_menu_lang_mains">繁体中文<span>zh-tw</span></a><a href="javascript:setlang('ja');" class="m_menu_lang_mains">日本語<span>ja</span></a><a href="javascript:setlang('ko');" class="m_menu_lang_mains">한국어<span>ko</span></a><a href="javascript:setlang('ms');" class="m_menu_lang_mains">Melayu<span>ms</span></a><a href="javascript:setlang('fr');" class="m_menu_lang_mains">Français<span>fr</span></a><a href="javascript:setlang('de');" class="m_menu_lang_mains">Deutsch<span>de</span></a></div></div></div></div></header><script> document.getElementById('lan1sp').addEventListener('click', function (event) { event.preventDefault(); var elements = document.getElementsByClassName('m_menu'); for (var i = 0; i < elements.length; i++) { elements[i].style.display = 'block'; } }); document.getElementById('m_editormain12main_topi_sp').addEventListener('click', function (event) { event.preventDefault(); var elements = document.getElementsByClassName('m_menu'); for (var i = 0; i < elements.length; i++) { elements[i].style.display = 'none'; } }); document.getElementById('lan1').addEventListener('click', function (event) { event.preventDefault(); var elements = document.getElementsByClassName('m_menu_lang'); for (var i = 0; i < elements.length; i++) { elements[i].style.display = 'block'; } }); document.getElementById('m_editormain12main_topi_lan').addEventListener('click', function (event) { event.preventDefault(); var elements = document.getElementsByClassName('m_menu_lang'); for (var i = 0; i < elements.length; i++) { elements[i].style.display = 'none'; } }); </script><main class="m_phpTopic_Details m_phpArticle_Details"><div class="fixed_tab"><a href="" title="" class="fixed_tab_img" id="fixed_tab_img"><img class="lazy" data-src="/static/imghwm/tab_tab.png" src="/static/imghw/default1.png" alt="" /></a></div><div class="m_editormain12main" style="display: none" id="fixed_tab_titlelist"><div class="m_editormain12main_top"><img class="lazy" data-src="/static/imghwm/logo.png" src="/static/imghw/default1.png" alt="logo" /><a href="" title="" title="" class="m_editormain12main_topi" id="fixed_tab_topi"><i class="layui-icon layui-icon-close"></i></a></div><div class="phpeditormainL"><div class="fixed_tab_as"><ul><li><span></span><a href="#範例" title="範例" class="fixed_tab_a">範例</a></li></ul></div><div class="m_editormain12_close"><a href="" title="" title="" id="fixed_tab_close">close</a></div></div></div><div class="Article_Details_main1M"><div class="phpgenera_Details_mainL1"><a href="https://m.php.cn/zh-tw/" title="首頁" class="phpgenera_Details_mainL1a">首頁</a><img class="lazy" data-src="/static/imghwm/top_right.png" src="/static/imghw/default1.png" alt="" /><a href="https://m.php.cn/zh-tw/web-designer.html" class="phpgenera_Details_mainL1a">web前端</a><img class="lazy" data-src="/static/imghwm/top_right.png" src="/static/imghw/default1.png" alt="" /><a href="https://m.php.cn/zh-tw/div-tutorial.html" class="phpgenera_Details_mainL1a">html教學</a><img class="lazy" data-src="/static/imghwm/top_right.png" src="/static/imghw/default1.png" alt="" /><span>HTML檔案輸入控制項的capture和accept屬性無法正常運作</span></div><div class="Articlelist_txts"><div class="Articlelist_txts_info"><h1><a href="" title="" class="Articlelist_txts_title">HTML檔案輸入控制項的capture和accept屬性無法正常運作</a></h1><div class="Articlelist_txts_info_head"><div class="author_info"><a href="https://m.php.cn/zh-tw/member/164.html" class="author_avatar"><img class="lazy" data-src="https://img.php.cn/upload/avatar/000/000/164/59190898474f6485.png" alt="PHPz" src="/static/imghw/default1.png" alt="author avatar" onerror="this.onerror=''; this.src='/static/imghw/default1.png'"></a><div class="author_detail"><a href="https://m.php.cn/zh-tw/member/164.html" class="author_name">PHPz</a></div></div></div><span class="Articlelist_txts_time">Sep 06, 2023 pm 02:25 PM</span><div class="Articlelist_txts_infos"><span class="Articlelist_txts_infoss on">html檔案 控制項 capture accept 工作</span></div></div></div><hr /><div class="article_main wenda-list"><p><img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/000/164/169398150582933.jpg?x-oss-process=image/resize,p_40" class="lazy" alt="HTML檔案輸入控制項的capture和accept屬性無法正常運作"></p> <p>使用<em>accept</em>屬性在HTML中設定伺服器接受的檔案類型。只能在<input type="file">標籤中使用該屬性。 </p> <h2 id="範例">範例</h2> <p>您可以嘗試執行以下程式碼來使用accept屬性:</p><pre class='brush:php;toolbar:false;'><!DOCTYPE html> <html> <head> <title>File Upload Box</title> </head> <body> <form> <input type = "file" name = "fileupload" accept = "image/*" /> </form> </body> </html></pre><p>capture 屬性是一個布林屬性,如果指定,則表示首選直接從裝置擷取媒體. ..。 </p> <p>capture 屬性不用於將相機選項包含在對話框,但表示首選從網路攝影機直接捕獲。 </p> <p>下面給出「正確」程式碼</p><pre class='brush:php;toolbar:false;'><input type = "file" accept = "image/*"></pre><p>以上是HTML檔案輸入控制項的capture和accept屬性無法正常運作的詳細內容。更多資訊請關注PHP中文網其他相關文章!</p></div><div class="wzconShengming_sp"><div class="bzsmdiv_sp">陳述</div><div>本文轉載於:tutorialspoint。如有侵權,請聯絡admin@php.cn刪除</div></div></div><div class="phpgenera_Details_mainL4"><div class="phpmain1_2_top"><a href="javascript:void(0);" class="phpmain1_2_top_title">相關文章<img class="lazy" data-src="/static/imghwm/index2_title2.png" src="/static/imghw/default1.png" alt="" /></a></div><div class="phpgenera_Details_mainL4_info"><div class="phphistorical_Version2_mids"><a href="https://m.php.cn/zh-tw/faq/1796803630.html" title="說明將一致的編碼樣式用於HTML標籤和屬性的重要性。" class="phphistorical_Version2_mids_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="https://img.php.cn/upload/article/001/253/068/174602888058018.jpg?x-oss-process=image/resize,p_40" alt="說明將一致的編碼樣式用於HTML標籤和屬性的重要性。" src="/static/imghw/default1.png" /></a><a href="https://m.php.cn/zh-tw/faq/1796803630.html" title="說明將一致的編碼樣式用於HTML標籤和屬性的重要性。" class="phphistorical_Version2_mids_title">說明將一致的編碼樣式用於HTML標籤和屬性的重要性。</a><span class="Articlelist_txts_time">May 01, 2025 am 12:01 AM</span><p class="Articlelist_txts_p">一致的HTML編碼風格很重要,因為它提高了代碼的可讀性、可維護性和效率。 1)使用小寫標籤和屬性,2)保持一致的縮進,3)選擇並堅持使用單引號或雙引號,4)避免在項目中混合使用不同風格,5)利用自動化工具如Prettier或ESLint來確保風格的一致性。</p></div><div class="phphistorical_Version2_mids"><a href="https://m.php.cn/zh-tw/faq/1796803517.html" title="如何在 Bootstrap 4 中實現多項目輪播?" class="phphistorical_Version2_mids_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="https://img.php.cn/upload/article/001/246/273/174531649964017.jpg?x-oss-process=image/resize,p_40" alt="如何在 Bootstrap 4 中實現多項目輪播?" src="/static/imghw/default1.png" /></a><a href="https://m.php.cn/zh-tw/faq/1796803517.html" title="如何在 Bootstrap 4 中實現多項目輪播?" class="phphistorical_Version2_mids_title">如何在 Bootstrap 4 中實現多項目輪播?</a><span class="Articlelist_txts_time">Apr 30, 2025 pm 03:24 PM</span><p class="Articlelist_txts_p">在Bootstrap4中實現多項目輪播的解決方案在Bootstrap4中實現多項目輪播並不是一件簡單的事情。雖然Bootstrap...</p></div><div class="phphistorical_Version2_mids"><a href="https://m.php.cn/zh-tw/faq/1796803513.html" title="deepseek官網是如何實現鼠標滾動事件穿透效果的?" class="phphistorical_Version2_mids_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="https://img.php.cn/upload/article/001/246/273/174531772592895.jpg?x-oss-process=image/resize,p_40" alt="deepseek官網是如何實現鼠標滾動事件穿透效果的?" src="/static/imghw/default1.png" /></a><a href="https://m.php.cn/zh-tw/faq/1796803513.html" title="deepseek官網是如何實現鼠標滾動事件穿透效果的?" class="phphistorical_Version2_mids_title">deepseek官網是如何實現鼠標滾動事件穿透效果的?</a><span class="Articlelist_txts_time">Apr 30, 2025 pm 03:21 PM</span><p class="Articlelist_txts_p">如何實現鼠標滾動事件穿透效果?在我們瀏覽網頁時,經常會遇到一些特別的交互設計。比如在deepseek官網上,�...</p></div><div class="phphistorical_Version2_mids"><a href="https://m.php.cn/zh-tw/faq/1796803509.html" title="HTML 視頻的播放控件樣式怎麼修改" class="phphistorical_Version2_mids_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="https://img.php.cn/upload/article/001/503/042/174537198390896.jpg?x-oss-process=image/resize,p_40" alt="HTML 視頻的播放控件樣式怎麼修改" src="/static/imghw/default1.png" /></a><a href="https://m.php.cn/zh-tw/faq/1796803509.html" title="HTML 視頻的播放控件樣式怎麼修改" class="phphistorical_Version2_mids_title">HTML 視頻的播放控件樣式怎麼修改</a><span class="Articlelist_txts_time">Apr 30, 2025 pm 03:18 PM</span><p class="Articlelist_txts_p">無法直接通過CSS修改HTML視頻的默認播放控件樣式。 1.使用JavaScript創建自定義控件。 2.通過CSS美化這些控件。 3.考慮兼容性、用戶體驗和性能,使用庫如Video.js或Plyr可簡化過程。</p></div><div class="phphistorical_Version2_mids"><a href="https://m.php.cn/zh-tw/faq/1796803505.html" title="在手機上使用原生select會帶來哪些問題?" class="phphistorical_Version2_mids_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="https://img.php.cn/upload/article/001/246/273/174539556427851.jpg?x-oss-process=image/resize,p_40" alt="在手機上使用原生select會帶來哪些問題?" src="/static/imghw/default1.png" /></a><a href="https://m.php.cn/zh-tw/faq/1796803505.html" title="在手機上使用原生select會帶來哪些問題?" class="phphistorical_Version2_mids_title">在手機上使用原生select會帶來哪些問題?</a><span class="Articlelist_txts_time">Apr 30, 2025 pm 03:15 PM</span><p class="Articlelist_txts_p">在手機上使用原生select的潛在問題在開發移動端應用時,我們常常會遇到選擇框的需求。通常情況下,開發者傾...</p></div><div class="phphistorical_Version2_mids"><a href="https://m.php.cn/zh-tw/faq/1796803501.html" title="在手機上使用原生select的弊端是什麼?" class="phphistorical_Version2_mids_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="https://img.php.cn/upload/article/001/246/273/174539689375240.jpg?x-oss-process=image/resize,p_40" alt="在手機上使用原生select的弊端是什麼?" src="/static/imghw/default1.png" /></a><a href="https://m.php.cn/zh-tw/faq/1796803501.html" title="在手機上使用原生select的弊端是什麼?" class="phphistorical_Version2_mids_title">在手機上使用原生select的弊端是什麼?</a><span class="Articlelist_txts_time">Apr 30, 2025 pm 03:12 PM</span><p class="Articlelist_txts_p">在手機上使用原生select的弊端是什麼?在移動設備上開發應用時,選擇合適的UI組件是非常重要的。許多開發者�...</p></div><div class="phphistorical_Version2_mids"><a href="https://m.php.cn/zh-tw/faq/1796803497.html" title="如何使用Three.js和Octree優化房間內第三人稱漫遊的碰撞處理?" class="phphistorical_Version2_mids_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="https://img.php.cn/upload/article/001/246/273/174540087224288.jpg?x-oss-process=image/resize,p_40" alt="如何使用Three.js和Octree優化房間內第三人稱漫遊的碰撞處理?" src="/static/imghw/default1.png" /></a><a href="https://m.php.cn/zh-tw/faq/1796803497.html" title="如何使用Three.js和Octree優化房間內第三人稱漫遊的碰撞處理?" class="phphistorical_Version2_mids_title">如何使用Three.js和Octree優化房間內第三人稱漫遊的碰撞處理?</a><span class="Articlelist_txts_time">Apr 30, 2025 pm 03:09 PM</span><p class="Articlelist_txts_p">使用Three.js和Octree優化房間內第三人稱漫遊的碰撞處理在Three.js中使用Octree實現房間內的第三人稱漫遊並添加碰�...</p></div><div class="phphistorical_Version2_mids"><a href="https://m.php.cn/zh-tw/faq/1796803493.html" title="在手機上使用原生select會遇到哪些問題?" class="phphistorical_Version2_mids_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="https://img.php.cn/upload/article/001/246/273/174540194775302.jpg?x-oss-process=image/resize,p_40" alt="在手機上使用原生select會遇到哪些問題?" src="/static/imghw/default1.png" /></a><a href="https://m.php.cn/zh-tw/faq/1796803493.html" title="在手機上使用原生select會遇到哪些問題?" class="phphistorical_Version2_mids_title">在手機上使用原生select會遇到哪些問題?</a><span class="Articlelist_txts_time">Apr 30, 2025 pm 03:06 PM</span><p class="Articlelist_txts_p">使用原生select在手機上的問題在移動設備上開發應用時,我們經常會遇到需要用戶進行選擇的場景。雖然原生sel...</p></div></div><a href="https://m.php.cn/zh-tw/web-designer.html" class="phpgenera_Details_mainL4_botton"><span>See all articles</span><img class="lazy" data-src="/static/imghwm/down_right.png" src="/static/imghw/default1.png" alt="" /></a></div><ins class="adsbygoogle" style="display:block" data-ad-format="fluid" data-ad-layout-key="-6t+ed+2i-1n-4w" data-ad-client="ca-pub-5902227090019525" data-ad-slot="8966999616"></ins><script> (adsbygoogle = window.adsbygoogle || []).push({}); </script><div class="AI_ToolDetails_main4sR"><div class="phpgenera_Details_mainR3"><div class="phpmain1_4R_readrank"><div class="phpmain1_4R_readrank_top"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="/static/imghwm/hottools2.png" src="/static/imghw/default1.png" alt="" /><h2>熱AI工具</h2></div><div class="phpgenera_Details_mainR3_bottom"><div class="phpmain_tab2_mids_top"><a href="https://m.php.cn/zh-tw/ai/undresserai-undress" title="Undresser.AI Undress" class="phpmain_tab2_mids_top_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="https://img.php.cn/upload/ai_manual/001/246/273/173411540686492.jpg?x-oss-process=image/resize,m_fill,h_50,w_50" src="/static/imghw/default1.png" alt="Undresser.AI Undress" /></a><div class="phpmain_tab2_mids_info"><a href="https://m.php.cn/zh-tw/ai/undresserai-undress" title="Undresser.AI Undress"class="phpmain_tab2_mids_title"><h3>Undresser.AI Undress</h3></a><p>人工智慧驅動的應用程序,用於創建逼真的裸體照片</p></div></div><div class="phpmain_tab2_mids_top"><a href="https://m.php.cn/zh-tw/ai/ai-clothes-remover" title="AI Clothes Remover" class="phpmain_tab2_mids_top_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="https://img.php.cn/upload/ai_manual/001/246/273/173411552797167.jpg?x-oss-process=image/resize,m_fill,h_50,w_50" src="/static/imghw/default1.png" alt="AI Clothes Remover" /></a><div class="phpmain_tab2_mids_info"><a href="https://m.php.cn/zh-tw/ai/ai-clothes-remover" title="AI Clothes Remover"class="phpmain_tab2_mids_title"><h3>AI Clothes Remover</h3></a><p>用於從照片中去除衣服的線上人工智慧工具。</p></div></div><div class="phpmain_tab2_mids_top"><a href="https://m.php.cn/zh-tw/ai/undress-ai-tool" title="Undress AI Tool" class="phpmain_tab2_mids_top_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="https://img.php.cn/upload/ai_manual/001/246/273/173410641626608.jpg?x-oss-process=image/resize,m_fill,h_50,w_50" src="/static/imghw/default1.png" alt="Undress AI Tool" /></a><div class="phpmain_tab2_mids_info"><a href="https://m.php.cn/zh-tw/ai/undress-ai-tool" title="Undress AI Tool"class="phpmain_tab2_mids_title"><h3>Undress AI Tool</h3></a><p>免費脫衣圖片</p></div></div><div class="phpmain_tab2_mids_top"><a href="https://m.php.cn/zh-tw/ai/clothoffio" title="Clothoff.io" class="phpmain_tab2_mids_top_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="https://img.php.cn/upload/ai_manual/001/246/273/173411529149311.jpg?x-oss-process=image/resize,m_fill,h_50,w_50" src="/static/imghw/default1.png" alt="Clothoff.io" /></a><div class="phpmain_tab2_mids_info"><a href="https://m.php.cn/zh-tw/ai/clothoffio" title="Clothoff.io"class="phpmain_tab2_mids_title"><h3>Clothoff.io</h3></a><p>AI脫衣器</p></div></div><div class="phpmain_tab2_mids_top"><a href="https://m.php.cn/zh-tw/ai/video-swap" title="Video Face Swap" class="phpmain_tab2_mids_top_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="https://img.php.cn/upload/ai_manual/001/246/273/173414504068133.jpg?x-oss-process=image/resize,m_fill,h_50,w_50" src="/static/imghw/default1.png" alt="Video Face Swap" /></a><div class="phpmain_tab2_mids_info"><a href="https://m.php.cn/zh-tw/ai/video-swap" title="Video Face Swap"class="phpmain_tab2_mids_title"><h3>Video Face Swap</h3></a><p>使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!</p></div></div></div><div class="phpgenera_Details_mainR3_more"><a href="https://m.php.cn/zh-tw/ai">顯示更多</a></div></div></div><div class="phpgenera_Details_mainR4"><div class="phpmain1_4R_readrank"><div class="phpmain1_4R_readrank_top"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="/static/imghwm/hotarticle2.png" src="/static/imghw/default1.png" alt="" /><h2>熱門文章</h2></div><div class="phpgenera_Details_mainR4_bottom"><div class="phpgenera_Details_mainR4_bottoms"><a href="https://m.php.cn/zh-tw/faq/1796789525.html" title="Windows 11 KB5054979中的新功能以及如何解決更新問題" class="phpgenera_Details_mainR4_bottom_title">Windows 11 KB5054979中的新功能以及如何解決更新問題</a><div class="phpgenera_Details_mainR4_bottoms_info"><span>3 週前</span><span>ByDDD</span></div></div><div class="phpgenera_Details_mainR4_bottoms"><a href="https://m.php.cn/zh-tw/faq/1796793874.html" title="如何修復KB5055523無法在Windows 11中安裝?" class="phpgenera_Details_mainR4_bottom_title">如何修復KB5055523無法在Windows 11中安裝?</a><div class="phpgenera_Details_mainR4_bottoms_info"><span>2 週前</span><span>ByDDD</span></div></div><div class="phpgenera_Details_mainR4_bottoms"><a href="https://m.php.cn/zh-tw/faq/1796787760.html" title="Inzoi:如何申請學校和大學" class="phpgenera_Details_mainR4_bottom_title">Inzoi:如何申請學校和大學</a><div class="phpgenera_Details_mainR4_bottoms_info"><span>4 週前</span><span>ByDDD</span></div></div><div class="phpgenera_Details_mainR4_bottoms"><a href="https://m.php.cn/zh-tw/faq/1796793871.html" title="如何修復KB5055518無法在Windows 10中安裝?" class="phpgenera_Details_mainR4_bottom_title">如何修復KB5055518無法在Windows 10中安裝?</a><div class="phpgenera_Details_mainR4_bottoms_info"><span>2 週前</span><span>ByDDD</span></div></div><div class="phpgenera_Details_mainR4_bottoms"><a href="https://m.php.cn/zh-tw/faq/1796788723.html" title="在哪裡可以找到Atomfall中的站點辦公室鑰匙" class="phpgenera_Details_mainR4_bottom_title">在哪裡可以找到Atomfall中的站點辦公室鑰匙</a><div class="phpgenera_Details_mainR4_bottoms_info"><span>4 週前</span><span>ByDDD</span></div></div></div><div class="phpgenera_Details_mainR3_more"><a href="https://m.php.cn/zh-tw/article.html">顯示更多</a></div></div></div><div class="phpgenera_Details_mainR3"><div class="phpmain1_4R_readrank"><div class="phpmain1_4R_readrank_top"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="/static/imghwm/hottools2.png" src="/static/imghw/default1.png" alt="" /><h2>熱工具</h2></div><div class="phpgenera_Details_mainR3_bottom"><div class="phpmain_tab2_mids_top"><a href="https://m.php.cn/zh-tw/toolset/development-tools/1544" title="MinGW - Minimalist GNU for Windows" class="phpmain_tab2_mids_top_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="" src="/static/imghw/default1.png" alt="MinGW - Minimalist GNU for Windows" /></a><div class="phpmain_tab2_mids_info"><a href="https://m.php.cn/zh-tw/toolset/development-tools/1544" title="MinGW - Minimalist GNU for Windows" class="phpmain_tab2_mids_title"><h3>MinGW - Minimalist GNU for Windows</h3></a><p>這個專案正在遷移到osdn.net/projects/mingw的過程中,你可以繼續在那裡關注我們。 MinGW:GNU編譯器集合(GCC)的本機Windows移植版本,可自由分發的導入函式庫和用於建置本機Windows應用程式的頭檔;包括對MSVC執行時間的擴展,以支援C99功能。 MinGW的所有軟體都可以在64位元Windows平台上運作。</p></div></div><div class="phpmain_tab2_mids_top"><a href="https://m.php.cn/zh-tw/toolset/development-tools/1545" title="SAP NetWeaver Server Adapter for Eclipse" class="phpmain_tab2_mids_top_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="https://img.php.cn/upload/manual/000/000/007/169165990824460.png" src="/static/imghw/default1.png" alt="SAP NetWeaver Server Adapter for Eclipse" /></a><div class="phpmain_tab2_mids_info"><a href="https://m.php.cn/zh-tw/toolset/development-tools/1545" title="SAP NetWeaver Server Adapter for Eclipse" class="phpmain_tab2_mids_title"><h3>SAP NetWeaver Server Adapter for Eclipse</h3></a><p>將Eclipse與SAP NetWeaver應用伺服器整合。</p></div></div><div class="phpmain_tab2_mids_top"><a href="https://m.php.cn/zh-tw/toolset/development-tools/93" title="SublimeText3漢化版" class="phpmain_tab2_mids_top_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="https://img.php.cn/upload/manual/000/000/001/58ab97a3baad9677.jpg" src="/static/imghw/default1.png" alt="SublimeText3漢化版" /></a><div class="phpmain_tab2_mids_info"><a href="https://m.php.cn/zh-tw/toolset/development-tools/93" title="SublimeText3漢化版" class="phpmain_tab2_mids_title"><h3>SublimeText3漢化版</h3></a><p>中文版,非常好用</p></div></div><div class="phpmain_tab2_mids_top"><a href="https://m.php.cn/zh-tw/toolset/development-tools/92" title="記事本++7.3.1" class="phpmain_tab2_mids_top_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="https://img.php.cn/upload/manual/000/000/001/58ab96f0f39f7357.jpg" src="/static/imghw/default1.png" alt="記事本++7.3.1" /></a><div class="phpmain_tab2_mids_info"><a href="https://m.php.cn/zh-tw/toolset/development-tools/92" title="記事本++7.3.1" class="phpmain_tab2_mids_title"><h3>記事本++7.3.1</h3></a><p>好用且免費的程式碼編輯器</p></div></div><div class="phpmain_tab2_mids_top"><a href="https://m.php.cn/zh-tw/toolset/development-tools/505" title="Dreamweaver Mac版" class="phpmain_tab2_mids_top_img"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="https://img.php.cn/upload/manual/000/000/001/58d36dab93a95387.png" src="/static/imghw/default1.png" alt="Dreamweaver Mac版" /></a><div class="phpmain_tab2_mids_info"><a href="https://m.php.cn/zh-tw/toolset/development-tools/505" title="Dreamweaver Mac版" class="phpmain_tab2_mids_title"><h3>Dreamweaver Mac版</h3></a><p>視覺化網頁開發工具</p></div></div></div><div class="phpgenera_Details_mainR3_more"><a href="https://m.php.cn/zh-tw/ai">顯示更多</a></div></div></div><div class="phpgenera_Details_mainR4"><div class="phpmain1_4R_readrank"><div class="phpmain1_4R_readrank_top"><img onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" onerror="this.onerror=''; this.src='/static/imghwm/default1.png'" class="lazy" data-src="/static/imghwm/hotarticle2.png" src="/static/imghw/default1.png" alt="" /><h2>熱門話題</h2></div><div class="phpgenera_Details_mainR4_bottom"><div class="phpgenera_Details_mainR4_bottoms"><a href="https://m.php.cn/zh-tw/faq/gmailyxdlrkzn" title="gmail信箱登陸入口在哪裡" class="phpgenera_Details_mainR4_bottom_title">gmail信箱登陸入口在哪裡</a><div class="phpgenera_Details_mainR4_bottoms_info"><div class="phpgenera_Details_mainR4_bottoms_infos"><img class="lazy" data-src="/static/imghwm/eyess.png" src="/static/imghw/default1.png" alt="" /><span>7865</span></div><div class="phpgenera_Details_mainR4_bottoms_infos"><img class="lazy" data-src="/static/imghwm/tiezi.png" src="/static/imghw/default1.png" alt="" /><span>15</span></div></div></div><div class="phpgenera_Details_mainR4_bottoms"><a href="https://m.php.cn/zh-tw/faq/java-tutorial" title="Java教學" class="phpgenera_Details_mainR4_bottom_title">Java教學</a><div class="phpgenera_Details_mainR4_bottoms_info"><div class="phpgenera_Details_mainR4_bottoms_infos"><img class="lazy" data-src="/static/imghwm/eyess.png" src="/static/imghw/default1.png" alt="" /><span>1649</span></div><div class="phpgenera_Details_mainR4_bottoms_infos"><img class="lazy" data-src="/static/imghwm/tiezi.png" src="/static/imghw/default1.png" alt="" /><span>14</span></div></div></div><div class="phpgenera_Details_mainR4_bottoms"><a href="https://m.php.cn/zh-tw/faq/cakephp-tutor" title="CakePHP 教程" class="phpgenera_Details_mainR4_bottom_title">CakePHP 教程</a><div class="phpgenera_Details_mainR4_bottoms_info"><div class="phpgenera_Details_mainR4_bottoms_infos"><img class="lazy" data-src="/static/imghwm/eyess.png" src="/static/imghw/default1.png" alt="" /><span>1407</span></div><div class="phpgenera_Details_mainR4_bottoms_infos"><img class="lazy" data-src="/static/imghwm/tiezi.png" src="/static/imghw/default1.png" alt="" /><span>52</span></div></div></div><div class="phpgenera_Details_mainR4_bottoms"><a href="https://m.php.cn/zh-tw/faq/laravel-tutori" title="Laravel 教程" class="phpgenera_Details_mainR4_bottom_title">Laravel 教程</a><div class="phpgenera_Details_mainR4_bottoms_info"><div class="phpgenera_Details_mainR4_bottoms_infos"><img class="lazy" data-src="/static/imghwm/eyess.png" src="/static/imghw/default1.png" alt="" /><span>1301</span></div><div class="phpgenera_Details_mainR4_bottoms_infos"><img class="lazy" data-src="/static/imghwm/tiezi.png" src="/static/imghw/default1.png" alt="" /><span>25</span></div></div></div><div class="phpgenera_Details_mainR4_bottoms"><a href="https://m.php.cn/zh-tw/faq/php-tutorial" title="PHP教程" class="phpgenera_Details_mainR4_bottom_title">PHP教程</a><div class="phpgenera_Details_mainR4_bottoms_info"><div class="phpgenera_Details_mainR4_bottoms_infos"><img class="lazy" data-src="/static/imghwm/eyess.png" src="/static/imghw/default1.png" alt="" /><span>1243</span></div><div class="phpgenera_Details_mainR4_bottoms_infos"><img class="lazy" data-src="/static/imghwm/tiezi.png" src="/static/imghw/default1.png" alt="" /><span>29</span></div></div></div></div><div class="phpgenera_Details_mainR3_more"><a href="https://m.php.cn/zh-tw/faq/zt">顯示更多</a></div></div></div></div></main><ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-5902227090019525" data-ad-slot="5027754603"></ins><script> (adsbygoogle = window.adsbygoogle || []).push({}); </script><footer><div class="footer"><div class="footertop"><img src="/static/imghwm/logo.png" alt=""><p>公益線上PHP培訓,幫助PHP學習者快速成長!</p></div><div class="footermid"><a href="https://m.php.cn/zh-tw/about/us.html">關於我們</a><a href="https://m.php.cn/zh-tw/about/disclaimer.html">免責聲明</a><a href="https://m.php.cn/zh-tw/update/article_0_1.html">Sitemap</a></div><div class="footerbottom"><p> © php.cn All rights reserved </p></div></div></footer><script>isLogin = 0;</script><script type="text/javascript" src="/static/layui/layui.js"></script><script type="text/javascript" src="/static/js/global.js?4.9.47"></script><script src="https://vdse.bdstatic.com//search-video.v1.min.js"></script><link rel='stylesheet' id='_main-css' href='/static/css/viewer.min.css' type='text/css' media='all'/><script type='text/javascript' src='/static/js/viewer.min.js?1'></script><script type='text/javascript' src='/static/js/jquery-viewer.min.js'></script><script> var _paq = window._paq = window._paq || []; /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { var u="https://tongji.php.cn/"; _paq.push(['setTrackerUrl', u+'matomo.php']); _paq.push(['setSiteId', '9']); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); })(); </script><script> jQuery.fn.wait = function (func, times, interval) { var _times = times || -1, //100次 _interval = interval || 20, //20毫秒每次 _self = this, _selector = this.selector, //选择器 _iIntervalID; //定时器id if( this.length ){ //如果已经获取到了,就直接执行函数 func && func.call(this); } else { _iIntervalID = setInterval(function() { if(!_times) { //是0就退出 clearInterval(_iIntervalID); } _times <= 0 || _times--; //如果是正数就 -- _self = $(_selector); //再次选择 if( _self.length ) { //判断是否取到 func && func.call(_self); clearInterval(_iIntervalID); } }, _interval); } return this; } $("table.syntaxhighlighter").wait(function() { $('table.syntaxhighlighter').append("<p class='cnblogs_code_footer'><span class='cnblogs_code_footer_icon'></span></p>"); }); $(document).on("click", ".cnblogs_code_footer",function(){ $(this).parents('table.syntaxhighlighter').css('display','inline-table');$(this).hide(); }); $('.nphpQianCont').viewer({navbar:true,title:false,toolbar:false,movable:false,viewed:function(){$('img').click(function(){$('.viewer-close').trigger('click');});}}); </script><script>// 通用函数,用于显示或隐藏元素 function toggleElementsDisplay(className, show) { const elements = document.getElementsByClassName(className); for (let i = 0; i < elements.length; i++) { elements[i].style.display = show ? "block" : "none"; } } // 页面加载完成后执行的主函数 document.addEventListener("DOMContentLoaded", () => { // 1. 绑定菜单按钮事件 const bindMenuEvents = () => { const toggleDisplay = (className, show, eventId) => { const element = document.getElementById(eventId); if (element) { element.addEventListener("click", (event) => { event.preventDefault(); toggleElementsDisplay(className, show); }); } }; toggleDisplay("m_editormain12main", true, "fixed_tab_img"); toggleDisplay("m_editormain12main", false, "fixed_tab_topi"); toggleDisplay("m_editormain12main", false, "fixed_tab_close"); toggleDisplay("m_menu", true, "lan1sp"); toggleDisplay("m_menu", false, "m_editormain12main_topi_sp"); toggleDisplay("m_menu_lang", true, "lan1"); toggleDisplay("m_menu_lang", false, "m_editormain12main_topi_lan"); }; // 2. 绑定滚动链接事件 const bindScrollLinks = () => { const titleList = document.getElementById("fixed_tab_titlelist"); const menuMain = document.getElementsByClassName("m_editormain12main")[0]; const links = document.querySelectorAll('.fixed_tab_a'); links.forEach(linkElement => { if (linkElement) { linkElement.addEventListener("click", async (e) => { e.preventDefault(); e.stopPropagation(); // 先隐藏菜单 if (menuMain) menuMain.style.display = "none"; if (titleList) titleList.style.display = "none"; // 获取目标元素的 ID const targetId = linkElement.getAttribute('href').substring(1); const targetElement = document.getElementById(targetId); // 等待 DOM 更新 await new Promise(resolve => requestAnimationFrame(resolve)); // 滚动到目标位置 if (targetElement) { targetElement.scrollIntoView({ behavior: "smooth", block: "start" }); } }); } }); }; // 3. 绑定关闭按钮事件 const bindCloseButton = () => { const closeButton = document.querySelector(".phpgenera_Details_mainR1_close"); const container = document.querySelector(".phpgenera_Details_mainR1"); if (closeButton && container) { closeButton.addEventListener("click", (event) => { event.preventDefault(); container.style.display = "none"; }); } }; // 4. 初始化菜单交互功能 const initMenuInteraction = () => { const menuGroupElements = document.querySelectorAll('.layui-menu-item-group'); menuGroupElements.forEach(menuItem => { menuItem.addEventListener('click', function(event) { if (event.target.closest('.m_menusnames')) { return; } this.classList.toggle('layui-menu-item-down'); this.classList.toggle('layui-menu-item-up'); const subMenuContainer = this.querySelector('.m_menusnames'); const icon = this.querySelector('.layui-icon'); if (subMenuContainer && icon) { if (this.classList.contains('layui-menu-item-down')) { subMenuContainer.style.display = 'block'; icon.classList.remove('layui-icon-down'); icon.classList.add('layui-icon-up'); } else { subMenuContainer.style.display = 'none'; icon.classList.remove('layui-icon-up'); icon.classList.add('layui-icon-down'); } } }); }); }; // 5. 初始化 layui 功能 const initLayui = () => { if (typeof layui !== 'undefined') { layui.use(function () { var util = layui.util; if (util && util.fixbar) { util.fixbar({ on: { mouseenter: function (type) { if (layer && layer.tips) { layer.tips(type, this, { tips: 4, fixed: true, }); } }, mouseleave: function (type) { if (layer && layer.closeAll) { layer.closeAll("tips"); } }, }, }); } }); } }; // 执行所有初始化函数 bindMenuEvents(); bindScrollLinks(); bindCloseButton(); initMenuInteraction(); initLayui(); }); </script></body></html>