2개 이상의 button 누르면 각 ifrme 으로 페이지 열기 > 기술자료

본문 바로가기

사이트 내 전체검색

2개 이상의 button 누르면 각 ifrme 으로 페이지 열기 > 기술자료

JavaScript 2개 이상의 button 누르면 각 ifrme 으로 페이지 열기

페이지 정보


본문

버튼 2개에 각각 iframe 으로 url 을 전송해서 페이지를 여는 방법입니다.
 
<script src="//code.jquery.com/jquery-latest.min.js"></script>
<button type="button" id="bntPostYourAdd1">다음</button>
<button type="button" id="bntPostYourAdd2">카카오 캘린더</button>
<br><br>
<iframe id="forPostyouradd1" data-src="https://daum.net" 
    src="about:blank" width="500" height="300" style="background-color:coral">
</iframe>
<script>
    function postYourAdd1() {
        var iframe = $("#forPostyouradd1");
        iframe.attr("src", iframe.data("src")); 
    }
    $("#bntPostYourAdd1").on("click", postYourAdd1);
</script>

<iframe id="forPostyouradd2" data-src="https://map.kakao.com" 
    src="about:blank" width="500" height="300" style="background-color:aqua">
</iframe>
<script>
    function postYourAdd2() {
        var iframe = $("#forPostyouradd2");
        iframe.attr("src", iframe.data("src")); 
    }
    $("#bntPostYourAdd2").on("click", postYourAdd2);
</script>

샘플 : http://happyjung.com/demo/javascript/button_iframe.php
 

참고자료
https://inpa.tistory.com/entry/open-iframe-on-button-click-Code
https://sir.kr/qa/525654

댓글목록

등록된 댓글이 없습니다.


Total 2,651건 2 페이지
  • RSS
기술자료 목록
열람
JavaScript   4349  2024-02-16 18:50 ~ 2024-02-16 20:37  
2630
Java   4454  2024-02-06 16:49  
2629
PHP   4575  2024-02-06 16:42  
2628
호스팅   3494  2024-01-29 12:54  
2627
PHP   3604  2024-01-26 11:04 ~ 2024-01-26 11:13  
2626
MySQL   3685  2024-01-08 17:37 ~ 2024-03-14 16:00  
2625
SQL   3920  2024-01-08 12:36  
2624
영카트   4110  2024-01-04 14:57  
2623
일반   4916  2023-12-15 18:33  
2622
Android   3964  2023-11-30 18:48 ~ 2023-11-30 19:41  
2621
전자결제   6300  2023-11-23 19:53  
2620
PHP   5483  2023-11-20 10:56 ~ 2023-11-20 11:14  
2619
Linux   4504  2023-11-09 19:55  
2618
그누보드   7717  2023-11-06 20:38 ~ 2026-08-30 08:20  
2617
Linux   5401  2023-11-01 21:41 ~ 2023-11-02 10:30  
2616
영카트   3952  2023-10-07 23:31  
2615
SNS   5247  2023-09-24 17:56  
2614
ClassicASP   4591  2023-09-14 08:38  
2613
APP   3803  2023-09-08 12:34 ~ 2023-09-08 17:36  
2612
Apple   5964  2023-09-01 18:16 ~ 2023-09-01 18:36  

검색

해피정닷컴 정보

회사소개 회사연혁 협력사 오시는길 서비스 이용약관 개인정보 처리방침

회사명: 해피정닷컴   대표: 정창용   전화: 070-7600-3500   팩스: 042-670-8272
주소: (34368) 대전시 대덕구 대화로 160 대전산업용재유통단지 1동 222호
개인정보보호책임자: 정창용   사업자번호: 119-05-36414
통신판매업신고: 제2024-대전대덕-0405호 [사업자등록확인]  
Copyright 2001~2026 해피정닷컴. All Rights Reserved.