search
HomeWeb Front-endHTML Tutorial《Java Script DOM编程艺术》读书笔记--DOM_html/css_WEB-ITnose

1、文档:DOM中的“D”

"D"代表document(文档)

2、对象:DOM中的“O”

“O”代表object(对象) 对象的分类

  • 用户定义对象(user-defined object)
  • 内建对象(native object)
  • 宿主对象(host object)

window对象window对象对应着浏览器窗口本身,这个对象的属性和方法通常统称为BOM(浏览器对象模型)BOM提供了window.open和window.blur等方法。以至于被滥用于各种弹出窗口和下拉菜单

3、模型:DOM中的“M”

“M”代表“Model”(模型)DOM把一份文档表示为一棵树(数学意义上的概念)示例代码

<!DOCTYPE html><html lang="en">  <head>    <meta charset="utf-8" />    <title>Shoping List<title>  </head>  <body>     <h1 id="What-to-buy">What to buy</h1>     <p title="a gentle reminder">Don’t forget to buy this stuff.<p>     <ul id="purchases">        <li> A tin of beans<li>        <li class="sale">Cheese<li>        <li class="sale important">Milk<li>        </ul>    <body>  </html>代码中<html>相当于树根,即根元素。<head>和<body>属于下一个分支,位于同一层次且互不包含,属于兄弟关系。<head>元素有两个子元素<meta>和<title>(属于兄弟关系)<body>元素有三个子元素<p>、<h1 id="ul-这三个属于兄弟关系-ul-也是一个父元素-有三个子元素-他们都是-li-元素-pre-p-如果你能把一个文档的各种元素想象成一棵家谱树-我们就可以用同样的术语描述DOM-但我觉得称为-strong-节点树-strong-更准确-p-h-节点">、<ul>(这三个属于兄弟关系。<ul>也是一个父元素,有三个子元素,他们都是<li>元素。

如果你能把一个文档的各种元素想象成一棵家谱树,我们就可以用同样的术语描述DOM。但我觉得称为“节点树”更准确

4、节点

节点(node)属于网络术语,它表示网络中的一个连接点。一个网络就是由一些节点构成的集合。DOM也是同样的情况,文档是由节点构成的集合。

  • 元素节点
  • 文本节点
  • 属性节点

4、1元素节点

DOM的原子是元素节点(element node)诸如

之类的元素。标签的名字就是元素的名字。元素也可以包含其他的元素。没有被包含在其他元素的唯一元素是元素,它是我们的节点树的根元素。

4、2文本节点

在上述例子中,

元素包含着文本“don't forget to buy this stuff.”它就是一个文本节点(text node)。

4、3属性节点

属性节点是对元素做出更具体的描述。例如,几乎所有的元素都有一个title属性,我们可以利用这个属性对包含在元素里的东西做出准确的描述:

<p title="a gentle reminder">Don't forget to buy this stuff.<p>

在DOM中title="a gentle reminder"是一个属性节点(attribute node),在前面的例子中无序清单元素

    有个id属性。有些清单元素
  • 有class属性。

    三者之间的关系.png

    4、4 CSS

    类似javascript脚本,我们也可以将CSS样式嵌在文档

    部分(style>标签之间)。也可以放在另外的一个文件里。**在HTML文件中引用CSS文件的格式:
    <link type="text/css" href="file.css" rel="stylesheet">

    继承(inheritance)是CSS技术中的一项强大功能。1)、 class属性

    <p class="special">This pargraph has the special class<p><h2 id="So-dose-this-headline">So dose this headline</h2>

    在样式表里可以为上面的代码进行定义

    special{font-style: italic;}

    还可以这样定义

    h2.special{text-transform: uppercase;}

    2)、id属性id属性的用途是给网页里的某个元素加上一个独一无二的标识符:

    <ul id="purchases">

    样式表定义

    #purchases{border:1px solid white;background-color:#333;color:#ccc;padding:1em;}
    #purchases li{font-weight:bold;}

    4、5获取元素

    有3种DOM方法可获取元素节点,分别是通过元素ID、通过标签名和通过类名字来获取

    • getElementById
    • getElementsByTagName
    • getElementsByClassName

    1)getElementById

    此方法将返回一个与那个有着给定id属性值的元素节点对应的对象,在javascript里注意大小写。它是document对象特有的函数,在脚本代码里,函数名的后面必须跟有一对圆括号,这对圆括号包含这函数的参数。document.getElementById(id)在getElementById方法中只有一个参数:你想获得的那个元素的id属性的值,这个id属性必须放在单引号或双引号里。docment.getElementById("purchases")这个调用将返回一个对象,这个对象对应着document对象里的一个独一无二的元素,那个元素的HTLM id属性值是purchases

              Shoping List<title>  </head>  <body>     <h1 id="What-to-buy">What to buy</h1>     <p title="a gentle reminder">Don’t forget to buy this stuff.<p>     <ul id="purchases">        <li> A tin of beans<li>        <li class="sale">Cheese<li>        <li class="sale important">Milk<li>        </ul>     <script>         alert(typeof docment.getElementById("purchases"));     </script>    <body>  </html>//利用`typeof`操作符进行验证(typeof操作符可以告诉我们它的操作数是一个字母、数值、函数、布尔值还是对象。</pre>   <p>验证可得是一个对象</p>   <h3 id="getElementsByTagName">2)getElementsByTagName</h3>   <p>getElementsByTagName方法返回一个对象数组,每个对象分别对应着文档里有着给定标签的一个元素。它的参数是标签的名字:decument.getElementByTagName(tag)</p>   <pre class='brush:php;toolbar:false;'>alert(document.getElementsByTagName("li").length);//显示文档里的列表元素个数为:3</pre>   <pre class='brush:php;toolbar:false;'><!DOCTYPE html><html lang="en">  <head>    <meta charset="utf-8" />    <title>Shoping List<title>  </head>  <body>     <h1 id="What-to-buy">What to buy</h1>     <p title="a gentle reminder">Don’t forget to buy this stuff.<p>     <ul id="purchases">        <li> A tin of beans<li>        <li class="sale">Cheese<li>        <li class="sale important">Milk<li>        </ul>     <script>         var items=document.getElementByTagName("li");         for (var i=0; i<items.length;i++){         alert(typeof items[i]);         }     </script>    <body>  </html>//代码运行结果显示三个alert对话框,显示的消息都是“object”。</pre>   <p>getElementsByTagName允许把一个通配符作为它的参数,通配符(*)必须放在引号里</p>   <pre class='brush:php;toolbar:false;'>alert(document.getElementsByTagName("*").length);//可以知道文档里有多少个元素节点</pre>   <pre class='brush:php;toolbar:false;'>var shopping=document.getElementById("purchases");var items=shopping.getElementsByTagName("*");//程序运行结果,items数组将只包含id属性值是purshase的元素清单的元素</pre>   <h3 id="getElementByClassName">3)getElementByClassName</h3>   <p>这个方法让我们能够通过class属性中的类名来访问元素,getElementByClassName也只接受一个参数,就是类名:</p>   <pre class='brush:php;toolbar:false;'>getElementByClassName(class)</pre>   <p>这个方法的返回值也与getElementsByTagName类似,都是一个具有相同类名的元素的数组。</p>   <pre class='brush:php;toolbar:false;'>document.getElementsByClassName("sale")</pre>   <p>利用这种方法还可有查找那些带有多个类名的元素。多个类名之间用空格分开即可</p>   <pre class='brush:php;toolbar:false;'>alert(document.getElementsByClassName("important sale").length);//对话框显示1,表示只有一个元素匹配。类名的顺序不重要,就算元素还带有更多类名也没有关系。</pre>   <p>也可以和getElementById组合使用</p>   <pre class='brush:php;toolbar:false;'>     var shopping=document.getElementById("purchase");     var sales=shopping.getElementsByClassName("sale");sales数组中包含的就只是位于“purchases”列表中的带有“sale”类的元素。</pre>   <p>getElementByClassName方法非常有用,但只有较新的浏览器才支持它。所以,需要使用已有的DOM方法来实现自己的getElementsByClassName。</p>   <pre class='brush:php;toolbar:false;'>function getElementsByClassName(node,classname){if (node.getElementsByClassName){//使用现有的方法return node.getElementsByTagName("*");for (var i=0; i<elems.length;i++){  if(elems[i].ClassName.indexof(classname)!= -1){results[results.length]=elems[i];          }      }return results;    }}</pre>   <h4 id="获取和设置属性">5 获取和设置属性</h4>   <ul>       <li>
    <strong>getAttribute方法</strong>(获取元素的属性)</li>    <li>
    <strong>setAttribute方法</strong>(更改属性节点值)5、1getAttributegetAttribute是一个函数,它只有一个参数(你所要查询的属性的名称)</li>   </ul>   </li>
    </ul></div><div class="wzconShengming_sp"><div class="bzsmdiv_sp">Statement</div><div>The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact 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">Related Article<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/faq/1796802246.html" title="What is the purpose of HTML tags?" 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/174576972169873.jpg?x-oss-process=image/resize,p_40" alt="What is the purpose of HTML tags?" src="/static/imghw/default1.png"  /></a><a href="https://m.php.cn/faq/1796802246.html" title="What is the purpose of HTML tags?" class="phphistorical_Version2_mids_title">What is the purpose of HTML tags?</a><span class="Articlelist_txts_time">Apr 28, 2025 am	 12:02 AM</span><p class="Articlelist_txts_p">HTMLtagsareessentialforstructuringwebpages,enhancingaccessibility,SEO,andperformance.1)Theyareenclosedinanglebracketsandusedinpairstocreateahierarchicalstructure.2)SemantictagslikeandimproveuserexperienceandSEO.3)Creativetagslikeenabledynamicgraphics</p></div><div class="phphistorical_Version2_mids"><a href="https://m.php.cn/faq/1796801937.html" title="What are self-closing tags? Give an example." 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/174568348286513.jpg?x-oss-process=image/resize,p_40" alt="What are self-closing tags? Give an example." src="/static/imghw/default1.png"  /></a><a href="https://m.php.cn/faq/1796801937.html" title="What are self-closing tags? Give an example." class="phphistorical_Version2_mids_title">What are self-closing tags? Give an example.</a><span class="Articlelist_txts_time">Apr 27, 2025 am	 12:04 AM</span><p class="Articlelist_txts_p">Self-closingtagsinHTMLandXMLaretagsthatclosethemselveswithoutneedingaseparateclosingtag,simplifyingmarkupstructureandenhancingcodingefficiency.1)TheyareessentialinXMLforelementswithoutcontent,ensuringwell-formeddocuments.2)InHTML5,usageisflexiblebutr</p></div><div class="phphistorical_Version2_mids"><a href="https://m.php.cn/faq/1796801649.html" title="Beyond HTML: Essential Technologies for Web Development" 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/174559705219982.jpg?x-oss-process=image/resize,p_40" alt="Beyond HTML: Essential Technologies for Web Development" src="/static/imghw/default1.png"  /></a><a href="https://m.php.cn/faq/1796801649.html" title="Beyond HTML: Essential Technologies for Web Development" class="phphistorical_Version2_mids_title">Beyond HTML: Essential Technologies for Web Development</a><span class="Articlelist_txts_time">Apr 26, 2025 am	 12:04 AM</span><p class="Articlelist_txts_p">To build a website with powerful functions and good user experience, HTML alone is not enough. The following technology is also required: JavaScript gives web page dynamic and interactiveness, and real-time changes are achieved by operating DOM. CSS is responsible for the style and layout of the web page to improve aesthetics and user experience. Modern frameworks and libraries such as React, Vue.js and Angular improve development efficiency and code organization structure.</p></div><div class="phphistorical_Version2_mids"><a href="https://m.php.cn/faq/1796801293.html" title="What are boolean attributes in HTML? Give some examples." 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/174551046248816.jpg?x-oss-process=image/resize,p_40" alt="What are boolean attributes in HTML? Give some examples." src="/static/imghw/default1.png"  /></a><a href="https://m.php.cn/faq/1796801293.html" title="What are boolean attributes in HTML? Give some examples." class="phphistorical_Version2_mids_title">What are boolean attributes in HTML? Give some examples.</a><span class="Articlelist_txts_time">Apr 25, 2025 am	 12:01 AM</span><p class="Articlelist_txts_p">Boolean attributes are special attributes in HTML that are activated without a value. 1. The Boolean attribute controls the behavior of the element by whether it exists or not, such as disabled disable the input box. 2.Their working principle is to change element behavior according to the existence of attributes when the browser parses. 3. The basic usage is to directly add attributes, and the advanced usage can be dynamically controlled through JavaScript. 4. Common mistakes are mistakenly thinking that values ​​need to be set, and the correct writing method should be concise. 5. The best practice is to keep the code concise and use Boolean properties reasonably to optimize web page performance and user experience.</p></div><div class="phphistorical_Version2_mids"><a href="https://m.php.cn/faq/1796800895.html" title="How can you validate your HTML code?" 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/174542425237814.jpg?x-oss-process=image/resize,p_40" alt="How can you validate your HTML code?" src="/static/imghw/default1.png"  /></a><a href="https://m.php.cn/faq/1796800895.html" title="How can you validate your HTML code?" class="phphistorical_Version2_mids_title">How can you validate your HTML code?</a><span class="Articlelist_txts_time">Apr 24, 2025 am	 12:04 AM</span><p class="Articlelist_txts_p">HTML code can be cleaner with online validators, integrated tools and automated processes. 1) Use W3CMarkupValidationService to verify HTML code online. 2) Install and configure HTMLHint extension in VisualStudioCode for real-time verification. 3) Use HTMLTidy to automatically verify and clean HTML files in the construction process.</p></div><div class="phphistorical_Version2_mids"><a href="https://m.php.cn/faq/1796800590.html" title="HTML vs. CSS and JavaScript: Comparing Web Technologies" 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/174533794691849.jpg?x-oss-process=image/resize,p_40" alt="HTML vs. CSS and JavaScript: Comparing Web Technologies" src="/static/imghw/default1.png"  /></a><a href="https://m.php.cn/faq/1796800590.html" title="HTML vs. CSS and JavaScript: Comparing Web Technologies" class="phphistorical_Version2_mids_title">HTML vs. CSS and JavaScript: Comparing Web Technologies</a><span class="Articlelist_txts_time">Apr 23, 2025 am	 12:05 AM</span><p class="Articlelist_txts_p">HTML, CSS and JavaScript are the core technologies for building modern web pages: 1. HTML defines the web page structure, 2. CSS is responsible for the appearance of the web page, 3. JavaScript provides web page dynamics and interactivity, and they work together to create a website with a good user experience.</p></div><div class="phphistorical_Version2_mids"><a href="https://m.php.cn/faq/1796800099.html" title="HTML as a Markup Language: Its Function and Purpose" 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/174525137146935.jpg?x-oss-process=image/resize,p_40" alt="HTML as a Markup Language: Its Function and Purpose" src="/static/imghw/default1.png"  /></a><a href="https://m.php.cn/faq/1796800099.html" title="HTML as a Markup Language: Its Function and Purpose" class="phphistorical_Version2_mids_title">HTML as a Markup Language: Its Function and Purpose</a><span class="Articlelist_txts_time">Apr 22, 2025 am	 12:02 AM</span><p class="Articlelist_txts_p">The function of HTML is to define the structure and content of a web page, and its purpose is to provide a standardized way to display information. 1) HTML organizes various parts of the web page through tags and attributes, such as titles and paragraphs. 2) It supports the separation of content and performance and improves maintenance efficiency. 3) HTML is extensible, allowing custom tags to enhance SEO.</p></div><div class="phphistorical_Version2_mids"><a href="https://m.php.cn/faq/1796798320.html" title="The Future of HTML, CSS, and JavaScript: Web Development Trends" 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/174499214213783.jpg?x-oss-process=image/resize,p_40" alt="The Future of HTML, CSS, and JavaScript: Web Development Trends" src="/static/imghw/default1.png"  /></a><a href="https://m.php.cn/faq/1796798320.html" title="The Future of HTML, CSS, and JavaScript: Web Development Trends" class="phphistorical_Version2_mids_title">The Future of HTML, CSS, and JavaScript: Web Development Trends</a><span class="Articlelist_txts_time">Apr 19, 2025 am	 12:02 AM</span><p class="Articlelist_txts_p">The future trends of HTML are semantics and web components, the future trends of CSS are CSS-in-JS and CSSHoudini, and the future trends of JavaScript are WebAssembly and Serverless. 1. HTML semantics improve accessibility and SEO effects, and Web components improve development efficiency, but attention should be paid to browser compatibility. 2. CSS-in-JS enhances style management flexibility but may increase file size. CSSHoudini allows direct operation of CSS rendering. 3.WebAssembly optimizes browser application performance but has a steep learning curve, and Serverless simplifies development but requires optimization of cold start problems.</p></div></div><a href="https://m.php.cn/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>Hot AI Tools</h2></div><div class="phpgenera_Details_mainR3_bottom"><div class="phpmain_tab2_mids_top"><a href="https://m.php.cn/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/ai/undresserai-undress" title="Undresser.AI Undress"class="phpmain_tab2_mids_title"><h3>Undresser.AI Undress</h3></a><p>AI-powered app for creating realistic nude photos</p></div></div><div class="phpmain_tab2_mids_top"><a href="https://m.php.cn/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/ai/ai-clothes-remover" title="AI Clothes Remover"class="phpmain_tab2_mids_title"><h3>AI Clothes Remover</h3></a><p>Online AI tool for removing clothes from photos.</p></div></div><div class="phpmain_tab2_mids_top"><a href="https://m.php.cn/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/ai/undress-ai-tool" title="Undress AI Tool"class="phpmain_tab2_mids_title"><h3>Undress AI Tool</h3></a><p>Undress images for free</p></div></div><div class="phpmain_tab2_mids_top"><a href="https://m.php.cn/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/ai/clothoffio" title="Clothoff.io"class="phpmain_tab2_mids_title"><h3>Clothoff.io</h3></a><p>AI clothes remover</p></div></div><div class="phpmain_tab2_mids_top"><a href="https://m.php.cn/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/ai/video-swap" title="Video Face Swap"class="phpmain_tab2_mids_title"><h3>Video Face Swap</h3></a><p>Swap faces in any video effortlessly with our completely free AI face swap tool!</p></div></div></div><div class="phpgenera_Details_mainR3_more"><a href="https://m.php.cn/ai">Show More</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>Hot Article</h2></div><div class="phpgenera_Details_mainR4_bottom"><div class="phpgenera_Details_mainR4_bottoms"><a href="https://m.php.cn/faq/1796785841.html" title="Assassin's Creed Shadows: Seashell Riddle Solution" class="phpgenera_Details_mainR4_bottom_title">Assassin's Creed Shadows: Seashell Riddle Solution</a><div class="phpgenera_Details_mainR4_bottoms_info"><span>1 months ago</span><span>ByDDD</span></div></div><div class="phpgenera_Details_mainR4_bottoms"><a href="https://m.php.cn/faq/1796789525.html" title="What's New in Windows 11 KB5054979 & How to Fix Update Issues" class="phpgenera_Details_mainR4_bottom_title">What's New in Windows 11 KB5054979 & How to Fix Update Issues</a><div class="phpgenera_Details_mainR4_bottoms_info"><span>3 weeks ago</span><span>ByDDD</span></div></div><div class="phpgenera_Details_mainR4_bottoms"><a href="https://m.php.cn/faq/1796785857.html" title="Where to find the Crane Control Keycard in Atomfall" class="phpgenera_Details_mainR4_bottom_title">Where to find the Crane Control Keycard in Atomfall</a><div class="phpgenera_Details_mainR4_bottoms_info"><span>1 months ago</span><span>ByDDD</span></div></div><div class="phpgenera_Details_mainR4_bottoms"><a href="https://m.php.cn/faq/1796793874.html" title="How to fix KB5055523 fails to install in Windows 11?" class="phpgenera_Details_mainR4_bottom_title">How to fix KB5055523 fails to install in Windows 11?</a><div class="phpgenera_Details_mainR4_bottoms_info"><span>2 weeks ago</span><span>ByDDD</span></div></div><div class="phpgenera_Details_mainR4_bottoms"><a href="https://m.php.cn/faq/1796787760.html" title="InZoi: How To Apply To School And University" class="phpgenera_Details_mainR4_bottom_title">InZoi: How To Apply To School And University</a><div class="phpgenera_Details_mainR4_bottoms_info"><span>3 weeks ago</span><span>ByDDD</span></div></div></div><div class="phpgenera_Details_mainR3_more"><a href="https://m.php.cn/article.html">Show More</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>Hot Tools</h2></div><div class="phpgenera_Details_mainR3_bottom"><div class="phpmain_tab2_mids_top"><a href="https://m.php.cn/toolset/development-tools/1473" title="SublimeText3 English version" 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/5aab40b1a662e720.jpg" src="/static/imghw/default1.png" alt="SublimeText3 English version" /></a><div class="phpmain_tab2_mids_info"><a href="https://m.php.cn/toolset/development-tools/1473" title="SublimeText3 English version" class="phpmain_tab2_mids_title"><h3>SublimeText3 English version</h3></a><p>Recommended: Win version, supports code prompts!</p></div></div><div class="phpmain_tab2_mids_top"><a href="https://m.php.cn/toolset/development-tools/502" title="ZendStudio 13.5.1 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/58d3631514435840.png" src="/static/imghw/default1.png" alt="ZendStudio 13.5.1 Mac" /></a><div class="phpmain_tab2_mids_info"><a href="https://m.php.cn/toolset/development-tools/502" title="ZendStudio 13.5.1 Mac" class="phpmain_tab2_mids_title"><h3>ZendStudio 13.5.1 Mac</h3></a><p>Powerful PHP integrated development environment</p></div></div><div class="phpmain_tab2_mids_top"><a href="https://m.php.cn/toolset/development-tools/1574" title="Safe Exam Browser" 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/017/169233952169011.png" src="/static/imghw/default1.png" alt="Safe Exam Browser" /></a><div class="phpmain_tab2_mids_info"><a href="https://m.php.cn/toolset/development-tools/1574" title="Safe Exam Browser" class="phpmain_tab2_mids_title"><h3>Safe Exam Browser</h3></a><p>Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.</p></div></div><div class="phpmain_tab2_mids_top"><a href="https://m.php.cn/toolset/development-tools/93" title="SublimeText3 Chinese version" 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 Chinese version" /></a><div class="phpmain_tab2_mids_info"><a href="https://m.php.cn/toolset/development-tools/93" title="SublimeText3 Chinese version" class="phpmain_tab2_mids_title"><h3>SublimeText3 Chinese version</h3></a><p>Chinese version, very easy to use</p></div></div><div class="phpmain_tab2_mids_top"><a href="https://m.php.cn/toolset/development-tools/1492" title="EditPlus Chinese cracked version" 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/5e21527e79622256.png" src="/static/imghw/default1.png" alt="EditPlus Chinese cracked version" /></a><div class="phpmain_tab2_mids_info"><a href="https://m.php.cn/toolset/development-tools/1492" title="EditPlus Chinese cracked version" class="phpmain_tab2_mids_title"><h3>EditPlus Chinese cracked version</h3></a><p>Small size, syntax highlighting, does not support code prompt function</p></div></div></div><div class="phpgenera_Details_mainR3_more"><a href="https://m.php.cn/ai">Show More</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>Hot Topics</h2></div><div class="phpgenera_Details_mainR4_bottom"><div class="phpgenera_Details_mainR4_bottoms"><a href="https://m.php.cn/faq/gmailyxdlrkzn" title="Where is the login entrance for gmail email?"  class="phpgenera_Details_mainR4_bottom_title">Where is the login entrance for gmail email?</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>7773</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/faq/java-tutorial" title="Java Tutorial"  class="phpgenera_Details_mainR4_bottom_title">Java Tutorial</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>1644</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/faq/cakephp-tutor" title="CakePHP Tutorial"  class="phpgenera_Details_mainR4_bottom_title">CakePHP Tutorial</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>1399</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/faq/laravel-tutori" title="Laravel Tutorial"  class="phpgenera_Details_mainR4_bottom_title">Laravel Tutorial</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>1296</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/faq/php-tutorial" title="PHP Tutorial"  class="phpgenera_Details_mainR4_bottom_title">PHP Tutorial</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>1234</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/faq/zt">Show More</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>Public welfare online PHP training,Help PHP learners grow quickly!</p></div><div class="footermid"><a href="https://m.php.cn/about/us.html">About us</a><a href="https://m.php.cn/about/disclaimer.html">Disclaimer</a><a href="https://m.php.cn/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>