웹 프론트엔드 JS 튜토리얼 js 타이머 활용(예제와 함께 설명)_javascript 스킬

js 타이머 활용(예제와 함께 설명)_javascript 스킬

May 16, 2016 pm 05:05 PM
js 시간제 노동자

자바스크립트에는 타이머 전용 함수가 두 개 있습니다.

1. 카운트다운 타이머: timename=setTimeout("function();",delaytime);
2. 루프 타이머: timename=setInterval("function();",delaytime);

첫 번째 매개변수인 "function()"은 타이머가 실행될 때 실행되는 동작입니다. 하나의 함수일 수도 있고 여러 함수일 수도 있습니다. 예를 들어 두 개의 경고 창을 표시하려면 "function();"을
"alert('첫 번째 경고 창!'); Alert('두 번째 경고 창!');"; 두 번째 매개변수 "delaytime"은 밀리초 단위의 간격 시간입니다. 즉, "5000"을 채우면 5초를 의미합니다.
카운트다운 타이머는 지정된 시간이 지나면 이벤트를 트리거하는 반면, 루프 타이머는 간격이 도래하면 이벤트를 반복적으로 트리거합니다. 둘의 차이점은 전자는 한 번만 작동하고 후자는 지속적으로 작동한다는 것입니다.
예를 들어, 페이지를 열고 몇 초마다 자동으로 다른 페이지로 이동하려면 카운트다운 타이머 "setTimeout("function();",delaytime)"을 사용해야 합니다. 한 번에 한 단어씩 나타나도록 문장을 설정하려면
루프 타이머 "setInterval("function();",delaytime)"을 사용해야 합니다.

양식의 포커스를 얻기 위해 document.activeElement.id가 사용됩니다. document.activeElement.id와 양식 ID가 동일한지 확인하려면 if를 사용하세요.
예: if ("mid" == document.activeElement.id) {alert();}, "mid"는 양식에 해당하는 ID입니다.

타이머:
는 특정 시간 이후에 실행될 프로그램을 지정하는 데 사용됩니다.

JS의 타이밍 실행, setTimeout과 setInterval의 차이점 및 취소 방법

setTimeout(Expression,DelayTime), DelayTime 이후에 표현식이 실행됩니다. setTimeout은 작업을 수행하기 전에 일정 시간 동안 지연하는 데 사용됩니다.
setTimeout("function",time)은 시간 초과 객체를 설정합니다

setInterval(expression, DelayTime), Expression은 DelayTime마다 실행됩니다.
setInterval("function", time)은 시간 초과 개체를 설정하는 데 자주 사용됩니다.

SetInterval은 자동으로 반복되며, setTimeout은 반복되지 않습니다.

clearTimeout(object)는 setTimeout 객체를 지웁니다

clearInterval(object)는 setInterval 객체를 지웁니다

두 가지 예만 들어보세요.

예제 1. 폼이 트리거되거나 로드되면 문자열을 그대로 출력

코드 복사 코드는 다음과 같습니다.

< head>

제목 없는 문서









예 2. 입력 상자에 포커스가 있을 때 입력 상자 정보를 정기적으로 확인하고, 포커스가 맞지 않을 때는 확인 작업을 수행하지 않습니다.

코드 복사 코드는 다음과 같습니다.



< title>제목 없는 문서












예제 3. 다음은 타이머가 만료된 후 경고 창이 팝업되는 가장 간단한 예입니다.

코드 복사 코드는 다음과 같습니다.




< ;script 언어="javascript">
function count() {
document.getElementByIdx_x_x('m').innerHTML="타이머가 시작되었습니다!";
setTimeout("alert(' 10초 후!')",10000)
}



< 입력 TYPE="button" value=" 타이밍 시작" onclick="count()">


예시 4: 카운트다운 시간 점프

코드 복사 코드는 다음과 같습니다.




내 JSP 'ds04.jsp' 시작 페이지< ;/ title><br> <span id="tiao">3</span><br> <a href="javascript:countDown"></a>초 후 자동으로 이동...<br> <meta http-equiv=refresh content=3;url= '/ds02.jsp'/><br> <!--스크립트 시작--><br> <script 언어="javascript" type= ""><br>function countDown(초){<br> tiao.innerText=secs;<br> if(--secs>0)<br> setTimeout("countDown(" 초 ")",1000 ); <br> }<br> countDown(3);<br> </script><br> <!--스크립트 끝--><br> </head><br> </div> <br><br>예 6: <p></p> <div class="codetitle"> <span><a style="CURSOR: pointer" data="44219" class="copybut" id="copybut44219" onclick="doCopy('code44219')"><u>코드 복사</u></a></span> 코드는 다음과 같습니다.</div> <div class="codebody" id="code44219"> <br><head> 메타 http-equiv="refresh" content="2;url='b.html'"> <br></head> <br><br> </div> 예 7:<p> </p> <p></p> <div class="codetitle"><span><a style="CURSOR: pointer" data="26465" class="copybut" id="copybut26465" onclick="doCopy('code26465')">코드 복사<u></u></a> 코드는 다음과 같습니다.</span></div> <div class="codebody" id="code26465"><script 언어="javascript" 유형 ="text /javascript"><br> setTimeout("window.location.href='b.html'", 2000);<br> //다음 두 가지 모두 사용할 수 있습니다<br> //setTimeout( "javascript:location.href='b.html'", 2000);<br> //setTimeout("window.location='b.html'", 2000);<br></script><br> <br> </div> 예 8:<p> </p> <p></p> <div class="codetitle"><span><a style="CURSOR: pointer" data="53168" class="copybut" id="copybut53168" onclick="doCopy('code53168')">코드 복사<u></u></a> 코드는 다음과 같습니다.</span></div> <div class="codebody" id="code53168"><span id="totalSecond"> ;2< /span><br><script 언어="javascript" type="text/javascript"><br> var second = document.getElementByIdx_x('totalSecond').innerHTML;<br> if(isNaN( second)) {<br> //...숫자 처리 방법이 아님<br> }else{<br> setInterval(function(){<br> document.getElementByIdx_x('totalSecond').innerHTML = --second; <br> if (두 번째 <= 0) {<br> window.location = 'b.html';<br> }<br> }, 1000);<br> } <br></script><br><br> </div> js 타이머(한 번 실행, 반복)<p> </p>한 번 실행되는 타이머와 반복적으로 실행되는 타이머로 구분되는 js 타이머의 작은 예인 js 코드 조각을 공유합니다. 초보자를 위한 참고용입니다. <p> </p>1, 한 번만 실행되는 타이머 <p> </p> <p></p> <div class="codetitle"><span><a style="CURSOR: pointer" data="73058" class="copybut" id="copybut73058" onclick="doCopy('code73058')">코드 복사<u></u></a> 코드는 다음과 같습니다.</span></div> <div class="codebody" id="code73058"><script> 타이머 비동기 실행 <br>function hello(){ <br> Alert("hello"); <br>} <br>//메서드 이름을 사용하여 메서드 실행 <br>var t1 = window.setTimeout(hello, 1000); <br>var t2 = window.setTimeout("hello()",3000);//문자열 실행 방법 사용 <br>window.clearTimeout(t1);//타이머 제거 <br></script&gt ;<br> <br><br> </div>2, 반복 실행을 위한 타이머 <p></p> <p></p> <div class="codetitle"><span>코드 복사<a style="CURSOR: pointer" data="39946" class="copybut" id="copybut39946" onclick="doCopy('code39946')"><u></u> 코드는 다음과 같습니다.</a><div class="codebody" id="code39946"> <br><script> <br>function hello(){ <br> Alert("hello") <br>} <br>//메서드 반복 실행 <br>var t1 = window. (hello,1000); <br>var t2 = window.setInterval("hello()",3000) <br>//타이머 제거 방법 <br>window.clearInterval(t1); /스크립트><br><br> </div> 비고: <p> </p>한 페이지에 두 가지 메소드가 있는데, 둘 다 페이지가 로드된 후 실행되지만 실제로는 순서대로 실행되지 않는 경우 다음 방법을 참고하여 문제를 해결할 수 있습니다. <p> onload 메서드의 타이머에서는 실행 전 일정 시간 동안 타이머 "지연"을 설정합니다. 이는 페이지 로드 순서와 실행 메서드를 구별하는 것으로 간주될 수 있습니다. <br> </p> <p><br><br></p> <div class="codetitle"> <span><a style="CURSOR: pointer" data="39283" class="copybut" id="copybut39283" onclick="doCopy('code39283')">코드 복사<u></u></a> 코드는 다음과 같습니다.</span><div class="codebody" id="code39283"> <br><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><br><html xmlns="http://www.w3.org/1999/xhtml"><br><head runat="server"><br>    <title>Untitled Page</title> <p>    <script language="javascript" type="text/javascript"><br>    var YC = new Object();<br>    function beginYC()<br>    {<br>        var secondsYC = document.getElementById("txtYCSeconds").value;<br>        try<br>        { <br>            YC = setTimeout("alert('延迟"+secondsYC+"秒成功')",secondsYC*1000);<br>        }<br>        catch(e)<br>        {<br>            alert("请输入正确的秒数。");<br>        }<br>    }<br>    function overYC()<br>    {<br>        clearTimeout(YC);<br>        YC=null;<br>        alert("终止延迟成功。");<br>    }<br><br>/**************************↓↓↓↓定时器的使用↓↓↓↓********************************/<br><br>    var timerDS = new Object();<br>    var timerDDS = new Object();<br>    function beginDS()<br>    {<br>        sn.innerHTML = "0";<br>        timerDS = setInterval("addOne()",parseInt(document.getElementById("txtIntervalSeconds").value,10)*1000);<br>    }<br>    function goonDS()<br>    {<br>        timerDS = setInterval("addOne()",parseInt(document.getElementById("txtIntervalSeconds").value,10)*1000);<br>    }<br>    function overDS()<br>    {<br>        clearInterval(timerDS);<br>        timerDS=null;<br>    }<br>    function delayDS()<br>    {<br>        overDS();<br>        timerDDS = setTimeout("goonDS()",document.getElementById("txtDDSSeconds").value*1000);<br>    }<br>    function addOne()<br>    {<br>        if(sn.innerHTML=="10")<br>        {<br>            overDS();<br>            alert("恭喜你,已成功达到10秒");<br>            return;<br>        }<br>        sn.innerHTML=parseInt(sn.innerHTML,10)+1;<br>    }<br><br>    </script></p> <p></head><br><body><br>    <form id="form1" runat="server"><br>    <div><br>        延迟器的使用:</div><br>    <div><br>     <label id="Label2" title="延迟秒数:"></label><br>        <input type="text" id="txtYCSeconds" value="3" /><br>        <input type="button" id="btnBYC" onclick="javascript:beginYC()" value="开始延迟" /><br>        <input type="button" id="btnOYC" onclick="javascript:overYC()" value="终止延迟" /><br>        <input type="button" id="Button1" onclick="javascript:alert('good monrning');" value="普通弹窗" /><br>    </div><br>    <br /><br>    <div><br>        定时器的使用:</div><br>    <div><br>    <div id="sn">0</div><br>  <label id="Label1" title="타이머 간격 초:"></label><br> > btnODS" onclick="javascript:overDS()" value="타이밍 종료" /> ;<br>   <input type="button" id="btnGDS" onclick="javascript:goonDS()" value="계속 타이밍 " /><br><br>  <label id="ds" 제목 ="지연 초:"></label><br> ="5" /><br>                                                                                                                                                 div><br> </form><br></body><br></ html><br><br><br></p> </div> </div></span></div> </div> </div> </div> <div class="wzconShengming_sp"> <div class="bzsmdiv_sp">본 웹사이트의 성명</div> <div>본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.</div> </div> </div> <ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-5902227090019525" data-ad-slot="2507867629"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> <div class="AI_ToolDetails_main4sR"> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-5902227090019525" data-ad-slot="3653428331" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> <!-- <div class="phpgenera_Details_mainR4"> <div class="phpmain1_4R_readrank"> <div class="phpmain1_4R_readrank_top"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/hotarticle2.png" alt="" /> <h2>인기 기사</h2> </div> <div class="phpgenera_Details_mainR4_bottom"> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/ko/faq/1796785841.html" title="어 ass 신 크리드 그림자 : 조개 수수께끼 솔루션" class="phpgenera_Details_mainR4_bottom_title">어 ass 신 크리드 그림자 : 조개 수수께끼 솔루션</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>3 몇 주 전</span> <span>By DDD</span> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/ko/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>2 몇 주 전</span> <span>By DDD</span> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/ko/faq/1796785857.html" title="Atomfall에서 크레인 제어 키 카드를 찾을 수 있습니다" class="phpgenera_Details_mainR4_bottom_title">Atomfall에서 크레인 제어 키 카드를 찾을 수 있습니다</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>3 몇 주 전</span> <span>By DDD</span> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/ko/faq/1796783009.html" title="어 ass 신 크리드 섀도우 - 대장장이를 찾고 무기 및 갑옷 커스터마 화 잠금 해제 방법" class="phpgenera_Details_mainR4_bottom_title">어 ass 신 크리드 섀도우 - 대장장이를 찾고 무기 및 갑옷 커스터마 화 잠금 해제 방법</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>1 몇 달 전</span> <span>By DDD</span> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/ko/faq/1796784440.html" title="<s> : 데드 레일 - 모든 도전을 완료하는 방법" class="phpgenera_Details_mainR4_bottom_title"><s> : 데드 레일 - 모든 도전을 완료하는 방법</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>3 몇 주 전</span> <span>By DDD</span> </div> </div> </div> <div class="phpgenera_Details_mainR3_more"> <a href="https://www.php.cn/ko/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/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/hottools2.png" alt="" /> <h2>핫 AI 도구</h2> </div> <div class="phpgenera_Details_mainR3_bottom"> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/ko/ai/undresserai-undress" title="Undresser.AI Undress" class="phpmain_tab2_mids_top_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/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://www.php.cn/ko/ai/undresserai-undress" title="Undresser.AI Undress" class="phpmain_tab2_mids_title"> <h3>Undresser.AI Undress</h3> </a> <p>사실적인 누드 사진을 만들기 위한 AI 기반 앱</p> </div> </div> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/ko/ai/ai-clothes-remover" title="AI Clothes Remover" class="phpmain_tab2_mids_top_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/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://www.php.cn/ko/ai/ai-clothes-remover" title="AI Clothes Remover" class="phpmain_tab2_mids_title"> <h3>AI Clothes Remover</h3> </a> <p>사진에서 옷을 제거하는 온라인 AI 도구입니다.</p> </div> </div> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/ko/ai/undress-ai-tool" title="Undress AI Tool" class="phpmain_tab2_mids_top_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/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://www.php.cn/ko/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://www.php.cn/ko/ai/clothoffio" title="Clothoff.io" class="phpmain_tab2_mids_top_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/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://www.php.cn/ko/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://www.php.cn/ko/ai/video-swap" title="Video Face Swap" class="phpmain_tab2_mids_top_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/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://www.php.cn/ko/ai/video-swap" title="Video Face Swap" class="phpmain_tab2_mids_title"> <h3>Video Face Swap</h3> </a> <p>완전히 무료인 AI 얼굴 교환 도구를 사용하여 모든 비디오의 얼굴을 쉽게 바꾸세요!</p> </div> </div> </div> <div class="phpgenera_Details_mainR3_more"> <a href="https://www.php.cn/ko/ai">더보기</a> </div> </div> </div> <script src="https://sw.php.cn/hezuo/cac1399ab368127f9b113b14eb3316d0.js" type="text/javascript"></script> <div class="phpgenera_Details_mainR4"> <div class="phpmain1_4R_readrank"> <div class="phpmain1_4R_readrank_top"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/hotarticle2.png" alt="" /> <h2>인기 기사</h2> </div> <div class="phpgenera_Details_mainR4_bottom"> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/ko/faq/1796785841.html" title="어 ass 신 크리드 그림자 : 조개 수수께끼 솔루션" class="phpgenera_Details_mainR4_bottom_title">어 ass 신 크리드 그림자 : 조개 수수께끼 솔루션</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>3 몇 주 전</span> <span>By DDD</span> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/ko/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>2 몇 주 전</span> <span>By DDD</span> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/ko/faq/1796785857.html" title="Atomfall에서 크레인 제어 키 카드를 찾을 수 있습니다" class="phpgenera_Details_mainR4_bottom_title">Atomfall에서 크레인 제어 키 카드를 찾을 수 있습니다</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>3 몇 주 전</span> <span>By DDD</span> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/ko/faq/1796783009.html" title="어 ass 신 크리드 섀도우 - 대장장이를 찾고 무기 및 갑옷 커스터마 화 잠금 해제 방법" class="phpgenera_Details_mainR4_bottom_title">어 ass 신 크리드 섀도우 - 대장장이를 찾고 무기 및 갑옷 커스터마 화 잠금 해제 방법</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>1 몇 달 전</span> <span>By DDD</span> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/ko/faq/1796784440.html" title="<s> : 데드 레일 - 모든 도전을 완료하는 방법" class="phpgenera_Details_mainR4_bottom_title"><s> : 데드 레일 - 모든 도전을 완료하는 방법</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>3 몇 주 전</span> <span>By DDD</span> </div> </div> </div> <div class="phpgenera_Details_mainR3_more"> <a href="https://www.php.cn/ko/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/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/hottools2.png" alt="" /> <h2>뜨거운 도구</h2> </div> <div class="phpgenera_Details_mainR3_bottom"> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/ko/toolset/development-tools/92" title="메모장++7.3.1" class="phpmain_tab2_mids_top_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/default1.png'" class="lazy" data-src="https://img.php.cn/upload/manual/000/000/001/58ab96f0f39f7357.jpg?x-oss-process=image/resize,m_fill,h_50,w_72" src="/static/imghw/default1.png" alt="메모장++7.3.1" /> </a> <div class="phpmain_tab2_mids_info"> <a href="https://www.php.cn/ko/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://www.php.cn/ko/toolset/development-tools/93" title="SublimeText3 중국어 버전" class="phpmain_tab2_mids_top_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/default1.png'" class="lazy" data-src="https://img.php.cn/upload/manual/000/000/001/58ab97a3baad9677.jpg?x-oss-process=image/resize,m_fill,h_50,w_72" src="/static/imghw/default1.png" alt="SublimeText3 중국어 버전" /> </a> <div class="phpmain_tab2_mids_info"> <a href="https://www.php.cn/ko/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://www.php.cn/ko/toolset/development-tools/121" title="스튜디오 13.0.1 보내기" class="phpmain_tab2_mids_top_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/default1.png'" class="lazy" data-src="https://img.php.cn/upload/manual/000/000/001/58ab97ecd1ab2670.jpg?x-oss-process=image/resize,m_fill,h_50,w_72" src="/static/imghw/default1.png" alt="스튜디오 13.0.1 보내기" /> </a> <div class="phpmain_tab2_mids_info"> <a href="https://www.php.cn/ko/toolset/development-tools/121" title="스튜디오 13.0.1 보내기" class="phpmain_tab2_mids_title"> <h3>스튜디오 13.0.1 보내기</h3> </a> <p>강력한 PHP 통합 개발 환경</p> </div> </div> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/ko/toolset/development-tools/469" title="드림위버 CS6" class="phpmain_tab2_mids_top_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/default1.png'" class="lazy" data-src="https://img.php.cn/upload/manual/000/000/001/58d0e0fc74683535.jpg?x-oss-process=image/resize,m_fill,h_50,w_72" src="/static/imghw/default1.png" alt="드림위버 CS6" /> </a> <div class="phpmain_tab2_mids_info"> <a href="https://www.php.cn/ko/toolset/development-tools/469" title="드림위버 CS6" class="phpmain_tab2_mids_title"> <h3>드림위버 CS6</h3> </a> <p>시각적 웹 개발 도구</p> </div> </div> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/ko/toolset/development-tools/500" title="SublimeText3 Mac 버전" class="phpmain_tab2_mids_top_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/default1.png'" class="lazy" data-src="https://img.php.cn/upload/manual/000/000/001/58d34035e2757995.png?x-oss-process=image/resize,m_fill,h_50,w_72" src="/static/imghw/default1.png" alt="SublimeText3 Mac 버전" /> </a> <div class="phpmain_tab2_mids_info"> <a href="https://www.php.cn/ko/toolset/development-tools/500" title="SublimeText3 Mac 버전" class="phpmain_tab2_mids_title"> <h3>SublimeText3 Mac 버전</h3> </a> <p>신 수준의 코드 편집 소프트웨어(SublimeText3)</p> </div> </div> </div> <div class="phpgenera_Details_mainR3_more"> <a href="https://www.php.cn/ko/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/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/hotarticle2.png" alt="" /> <h2>뜨거운 주제</h2> </div> <div class="phpgenera_Details_mainR4_bottom"> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/ko/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 src="/static/imghw/eyess.png" alt="" /> <span>7626</span> </div> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/tiezi.png" alt="" /> <span>15</span> </div> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/ko/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 src="/static/imghw/eyess.png" alt="" /> <span>1389</span> </div> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/tiezi.png" alt="" /> <span>52</span> </div> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/ko/faq/steamdzhmcssmgs" title="Steam의 계정 이름 형식은 무엇입니까?" class="phpgenera_Details_mainR4_bottom_title">Steam의 계정 이름 형식은 무엇입니까?</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/eyess.png" alt="" /> <span>89</span> </div> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/tiezi.png" alt="" /> <span>11</span> </div> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/ko/faq/winactivationkeyper" title="Win11 활성화 키 영구" class="phpgenera_Details_mainR4_bottom_title">Win11 활성화 키 영구</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/eyess.png" alt="" /> <span>70</span> </div> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/tiezi.png" alt="" /> <span>19</span> </div> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/ko/faq/newyorktimesdailybrief" title="NYT 연결 힌트와 답변" class="phpgenera_Details_mainR4_bottom_title">NYT 연결 힌트와 답변</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/eyess.png" alt="" /> <span>31</span> </div> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/tiezi.png" alt="" /> <span>140</span> </div> </div> </div> </div> <div class="phpgenera_Details_mainR3_more"> <a href="https://www.php.cn/ko/faq/zt">더보기</a> </div> </div> </div> </div> </div> <div class="Article_Details_main2"> <div class="phpgenera_Details_mainL4"> <div class="phpmain1_2_top"> <a href="javascript:void(0);" class="phpmain1_2_top_title">Related knowledge<img src="/static/imghw/index2_title2.png" alt="" /></a> </div> <div class="phpgenera_Details_mainL4_info"> <div class="phphistorical_Version2_mids"> <a href="https://www.php.cn/ko/faq/629494.html" title="JS 및 Baidu Maps를 사용하여 지도 이동 기능을 구현하는 방법" class="phphistorical_Version2_mids_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/default1.png" class="lazy" data-src="https://img.php.cn/upload/article/000/000/164/170053204074362.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="JS 및 Baidu Maps를 사용하여 지도 이동 기능을 구현하는 방법" /> </a> <a href="https://www.php.cn/ko/faq/629494.html" title="JS 및 Baidu Maps를 사용하여 지도 이동 기능을 구현하는 방법" class="phphistorical_Version2_mids_title">JS 및 Baidu Maps를 사용하여 지도 이동 기능을 구현하는 방법</a> <span class="Articlelist_txts_time">Nov 21, 2023 am 10:00 AM</span> <p class="Articlelist_txts_p">JS 및 Baidu Map을 사용하여 지도 팬 기능을 구현하는 방법 Baidu Map은 지리 정보, 위치 지정 및 기타 기능을 표시하기 위해 웹 개발에 자주 사용되는 널리 사용되는 지도 서비스 플랫폼입니다. 이 글에서는 JS와 Baidu Map API를 사용하여 지도 이동 기능을 구현하는 방법을 소개하고 구체적인 코드 예제를 제공합니다. 1. 준비 바이두 맵 API를 사용하기 전에 먼저 바이두 맵 오픈 플랫폼(http://lbsyun.baidu.com/)에서 개발자 계정을 신청하고 애플리케이션을 만들어야 합니다. 생성 완료</p> </div> <div class="phphistorical_Version2_mids"> <a href="https://www.php.cn/ko/faq/734386.html" title="권장 사항: 우수한 JS 오픈 소스 얼굴 감지 및 인식 프로젝트" class="phphistorical_Version2_mids_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/default1.png" class="lazy" data-src="https://img.php.cn/upload/article/000/887/227/171211651392093.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="권장 사항: 우수한 JS 오픈 소스 얼굴 감지 및 인식 프로젝트" /> </a> <a href="https://www.php.cn/ko/faq/734386.html" title="권장 사항: 우수한 JS 오픈 소스 얼굴 감지 및 인식 프로젝트" class="phphistorical_Version2_mids_title">권장 사항: 우수한 JS 오픈 소스 얼굴 감지 및 인식 프로젝트</a> <span class="Articlelist_txts_time">Apr 03, 2024 am 11:55 AM</span> <p class="Articlelist_txts_p">얼굴 검출 및 인식 기술은 이미 상대적으로 성숙하고 널리 사용되는 기술입니다. 현재 가장 널리 사용되는 인터넷 응용 언어는 JS입니다. 웹 프런트엔드에서 얼굴 감지 및 인식을 구현하는 것은 백엔드 얼굴 인식에 비해 장점과 단점이 있습니다. 장점에는 네트워크 상호 작용 및 실시간 인식이 줄어 사용자 대기 시간이 크게 단축되고 사용자 경험이 향상된다는 단점이 있습니다. 모델 크기에 따라 제한되고 정확도도 제한됩니다. js를 사용하여 웹에서 얼굴 인식을 구현하는 방법은 무엇입니까? 웹에서 얼굴 인식을 구현하려면 JavaScript, HTML, CSS, WebRTC 등 관련 프로그래밍 언어 및 기술에 익숙해야 합니다. 동시에 관련 컴퓨터 비전 및 인공지능 기술도 마스터해야 합니다. 웹 측면의 디자인으로 인해 주목할 가치가 있습니다.</p> </div> <div class="phphistorical_Version2_mids"> <a href="https://www.php.cn/ko/faq/633499.html" title="주식 분석을 위한 필수 도구: PHP 및 JS를 사용하여 캔들 차트를 그리는 단계를 알아보세요." class="phphistorical_Version2_mids_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/default1.png" class="lazy" data-src="https://img.php.cn/upload/article/000/465/014/170281051584846.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="주식 분석을 위한 필수 도구: PHP 및 JS를 사용하여 캔들 차트를 그리는 단계를 알아보세요." /> </a> <a href="https://www.php.cn/ko/faq/633499.html" title="주식 분석을 위한 필수 도구: PHP 및 JS를 사용하여 캔들 차트를 그리는 단계를 알아보세요." class="phphistorical_Version2_mids_title">주식 분석을 위한 필수 도구: PHP 및 JS를 사용하여 캔들 차트를 그리는 단계를 알아보세요.</a> <span class="Articlelist_txts_time">Dec 17, 2023 pm 06:55 PM</span> <p class="Articlelist_txts_p">주식 분석을 위한 필수 도구: PHP 및 JS에서 캔들 차트를 그리는 단계를 배우십시오. 인터넷과 기술의 급속한 발전으로 주식 거래는 많은 투자자에게 중요한 방법 중 하나가 되었습니다. 주식분석은 투자자의 의사결정에 있어 중요한 부분이며 캔들차트는 기술적 분석에 널리 사용됩니다. PHP와 JS를 사용하여 캔들 차트를 그리는 방법을 배우면 투자자가 더 나은 결정을 내리는 데 도움이 되는 보다 직관적인 정보를 얻을 수 있습니다. 캔들스틱 차트는 주가를 캔들스틱 형태로 표시하는 기술 차트입니다. 주가를 보여주네요</p> </div> <div class="phphistorical_Version2_mids"> <a href="https://www.php.cn/ko/faq/633266.html" title="PHP와 JS를 사용하여 주식 촛대 차트를 만드는 방법" class="phphistorical_Version2_mids_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/default1.png" class="lazy" data-src="https://img.php.cn/upload/article/000/887/227/170277173527364.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="PHP와 JS를 사용하여 주식 촛대 차트를 만드는 방법" /> </a> <a href="https://www.php.cn/ko/faq/633266.html" title="PHP와 JS를 사용하여 주식 촛대 차트를 만드는 방법" class="phphistorical_Version2_mids_title">PHP와 JS를 사용하여 주식 촛대 차트를 만드는 방법</a> <span class="Articlelist_txts_time">Dec 17, 2023 am 08:08 AM</span> <p class="Articlelist_txts_p">PHP와 JS를 사용하여 주식 캔들 차트를 만드는 방법 주식 캔들 차트는 주식 시장에서 흔히 사용되는 기술 분석 그래픽으로 시가, 종가, 최고가 등의 데이터를 그려서 투자자가 주식을 보다 직관적으로 이해할 수 있도록 도와줍니다. 주식의 최저 가격. 이 기사에서는 특정 코드 예제와 함께 PHP 및 JS를 사용하여 주식 캔들 차트를 만드는 방법을 설명합니다. 1. 준비 시작하기 전에 다음 환경을 준비해야 합니다. 1. PHP를 실행하는 서버 2. HTML5 및 Canvas를 지원하는 브라우저 3</p> </div> <div class="phphistorical_Version2_mids"> <a href="https://www.php.cn/ko/faq/629525.html" title="JS와 Baidu Map을 활용하여 지도 클릭 이벤트 처리 기능을 구현하는 방법" class="phphistorical_Version2_mids_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/default1.png" class="lazy" data-src="https://img.php.cn/upload/article/000/000/164/170053627491331.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="JS와 Baidu Map을 활용하여 지도 클릭 이벤트 처리 기능을 구현하는 방법" /> </a> <a href="https://www.php.cn/ko/faq/629525.html" title="JS와 Baidu Map을 활용하여 지도 클릭 이벤트 처리 기능을 구현하는 방법" class="phphistorical_Version2_mids_title">JS와 Baidu Map을 활용하여 지도 클릭 이벤트 처리 기능을 구현하는 방법</a> <span class="Articlelist_txts_time">Nov 21, 2023 am 11:11 AM</span> <p class="Articlelist_txts_p">JS 및 Baidu Maps를 사용하여 지도 클릭 이벤트 처리 기능을 구현하는 방법 개요: 웹 개발에서는 지리적 위치 및 지리적 정보를 표시하기 위해 지도 기능을 사용해야 하는 경우가 많습니다. 지도에서의 클릭 이벤트 처리는 지도 기능에서 일반적으로 사용되는 중요한 부분입니다. 이 글에서는 JS와 Baidu Map API를 사용하여 지도의 클릭 이벤트 처리 기능을 구현하는 방법을 소개하고 구체적인 코드 예제를 제공합니다. 단계: Baidu Map API 파일 가져오기 먼저 다음 코드를 통해 Baidu Map API 파일을 가져올 수 있습니다.</p> </div> <div class="phphistorical_Version2_mids"> <a href="https://www.php.cn/ko/faq/629475.html" title="JS 및 Baidu Maps를 사용하여 지도 히트맵 기능을 구현하는 방법" class="phphistorical_Version2_mids_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/default1.png" class="lazy" data-src="https://img.php.cn/upload/article/000/887/227/170053040496360.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="JS 및 Baidu Maps를 사용하여 지도 히트맵 기능을 구현하는 방법" /> </a> <a href="https://www.php.cn/ko/faq/629475.html" title="JS 및 Baidu Maps를 사용하여 지도 히트맵 기능을 구현하는 방법" class="phphistorical_Version2_mids_title">JS 및 Baidu Maps를 사용하여 지도 히트맵 기능을 구현하는 방법</a> <span class="Articlelist_txts_time">Nov 21, 2023 am 09:33 AM</span> <p class="Articlelist_txts_p">JS 및 Baidu Maps를 사용하여 지도 열 지도 기능을 구현하는 방법 소개: 인터넷과 모바일 장치의 급속한 발전으로 지도는 일반적인 응용 시나리오가 되었습니다. 시각적 표시 방법인 히트맵은 데이터 분포를 보다 직관적으로 이해하는 데 도움이 될 수 있습니다. 이 기사에서는 JS 및 Baidu Map API를 사용하여 지도 히트맵 기능을 구현하는 방법을 소개하고 구체적인 코드 예제를 제공합니다. 준비 작업: 시작하기 전에 Baidu 개발자 계정, 애플리케이션 생성, 해당 AP 획득 등의 항목을 준비해야 합니다.</p> </div> <div class="phphistorical_Version2_mids"> <a href="https://www.php.cn/ko/faq/633755.html" title="PHP 및 JS 개발 팁: 주식 캔들 차트 그리기 방법 익히기" class="phphistorical_Version2_mids_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/default1.png" class="lazy" data-src="https://img.php.cn/upload/article/000/887/227/170288520192764.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="PHP 및 JS 개발 팁: 주식 캔들 차트 그리기 방법 익히기" /> </a> <a href="https://www.php.cn/ko/faq/633755.html" title="PHP 및 JS 개발 팁: 주식 캔들 차트 그리기 방법 익히기" class="phphistorical_Version2_mids_title">PHP 및 JS 개발 팁: 주식 캔들 차트 그리기 방법 익히기</a> <span class="Articlelist_txts_time">Dec 18, 2023 pm 03:39 PM</span> <p class="Articlelist_txts_p">인터넷 금융의 급속한 발전으로 인해 주식 투자는 점점 더 많은 사람들의 선택이 되었습니다. 주식 거래에서 캔들 차트는 주가의 변화 추세를 보여주고 투자자가 보다 정확한 결정을 내리는 데 도움이 되는 일반적으로 사용되는 기술적 분석 방법입니다. 이 기사에서는 PHP와 JS의 개발 기술을 소개하고 독자가 주식 캔들 차트를 그리는 방법을 이해하도록 유도하며 구체적인 코드 예제를 제공합니다. 1. 주식 캔들 차트의 이해 주식 캔들 차트를 그리는 방법을 소개하기 전에 먼저 캔들 차트가 무엇인지부터 이해해야 합니다. 캔들스틱 차트는 일본인이 개발했습니다.</p> </div> <div class="phphistorical_Version2_mids"> <a href="https://www.php.cn/ko/faq/629514.html" title="JS 및 Baidu Maps를 사용하여 지도 다각형 그리기 기능을 구현하는 방법" class="phphistorical_Version2_mids_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/default1.png" class="lazy" data-src="https://img.php.cn/upload/article/000/465/014/170053520228035.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="JS 및 Baidu Maps를 사용하여 지도 다각형 그리기 기능을 구현하는 방법" /> </a> <a href="https://www.php.cn/ko/faq/629514.html" title="JS 및 Baidu Maps를 사용하여 지도 다각형 그리기 기능을 구현하는 방법" class="phphistorical_Version2_mids_title">JS 및 Baidu Maps를 사용하여 지도 다각형 그리기 기능을 구현하는 방법</a> <span class="Articlelist_txts_time">Nov 21, 2023 am 10:53 AM</span> <p class="Articlelist_txts_p">JS 및 Baidu Maps를 사용하여 지도 다각형 그리기 기능을 구현하는 방법 현대 웹 개발에서 지도 애플리케이션은 일반적인 기능 중 하나가 되었습니다. 지도에 다각형을 그리면 사용자가 보고 분석할 특정 영역을 표시하는 데 도움이 될 수 있습니다. 이 기사에서는 JS 및 Baidu Map API를 사용하여 지도 다각형 그리기 기능을 구현하는 방법을 소개하고 구체적인 코드 예제를 제공합니다. 먼저 Baidu Map API를 도입해야 합니다. 다음 코드를 사용하여 Baidu Map API의 JavaScript를 HTML 파일로 가져올 수 있습니다.</p> </div> </div> <a href="https://www.php.cn/ko/web-designer.html" class="phpgenera_Details_mainL4_botton"> <span>See all articles</span> <img src="/static/imghw/down_right.png" alt="" /> </a> </div> </div> </div> </main> <footer> <div class="footer"> <div class="footertop"> <img src="/static/imghw/logo.png" alt=""> <p>공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!</p> </div> <div class="footermid"> <a href="https://www.php.cn/ko/about/us.html">회사 소개</a> <a href="https://www.php.cn/ko/about/disclaimer.html">부인 성명</a> <a href="https://www.php.cn/ko/update/article_0_1.html">Sitemap</a> </div> <div class="footerbottom"> <p> © php.cn All rights reserved </p> </div> </div> </footer> <input type="hidden" id="verifycode" value="/captcha.html"> <script>layui.use(['element', 'carousel'], function () {var element = layui.element;$ = layui.jquery;var carousel = layui.carousel;carousel.render({elem: '#test1', width: '100%', height: '330px', arrow: 'always'});$.getScript('/static/js/jquery.lazyload.min.js', function () {$("img").lazyload({placeholder: "/static/images/load.jpg", effect: "fadeIn", threshold: 200, skip_invisible: false});});});</script> <script src="/static/js/common_new.js"></script> <script type="text/javascript" src="/static/js/jquery.cookie.js?1745255977"></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?2' 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 type="text/javascript" src="/static/js/global.min.js?5.5.53"></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> // top layui.use(function () { var util = layui.util; util.fixbar({ on: { mouseenter: function (type) { layer.tips(type, this, { tips: 4, fixed: true, }); }, mouseleave: function (type) { layer.closeAll("tips"); }, }, }); }); document.addEventListener("DOMContentLoaded", (event) => { // 定义一个函数来处理滚动链接的点击事件 function setupScrollLink(scrollLinkId, targetElementId) { const scrollLink = document.getElementById(scrollLinkId); const targetElement = document.getElementById(targetElementId); if (scrollLink && targetElement) { scrollLink.addEventListener("click", (e) => { e.preventDefault(); // 阻止默认链接行为 targetElement.scrollIntoView({ behavior: "smooth" }); // 平滑滚动到目标元素 }); } else { console.warn( `Either scroll link with ID '${scrollLinkId}' or target element with ID '${targetElementId}' not found.` ); } } // 使用该函数设置多个滚动链接 setupScrollLink("Article_Details_main1L2s_1", "article_main_title1"); setupScrollLink("Article_Details_main1L2s_2", "article_main_title2"); setupScrollLink("Article_Details_main1L2s_3", "article_main_title3"); setupScrollLink("Article_Details_main1L2s_4", "article_main_title4"); setupScrollLink("Article_Details_main1L2s_5", "article_main_title5"); setupScrollLink("Article_Details_main1L2s_6", "article_main_title6"); // 可以继续添加更多的滚动链接设置 }); window.addEventListener("scroll", function () { var fixedElement = document.getElementById("Article_Details_main1Lmain"); var scrollTop = window.scrollY || document.documentElement.scrollTop; // 兼容不同浏览器 var clientHeight = window.innerHeight || document.documentElement.clientHeight; // 视口高度 var scrollHeight = document.documentElement.scrollHeight; // 页面总高度 // 计算距离底部的距离 var distanceToBottom = scrollHeight - scrollTop - clientHeight; // 当距离底部小于或等于300px时,取消固定定位 if (distanceToBottom <= 980) { fixedElement.classList.remove("Article_Details_main1Lmain"); fixedElement.classList.add("Article_Details_main1Lmain_relative"); } else { // 否则,保持固定定位 fixedElement.classList.remove("Article_Details_main1Lmain_relative"); fixedElement.classList.add("Article_Details_main1Lmain"); } }); </script> </body> </html>