>웹 프론트엔드 >JS 튜토리얼 >JS 상위 페이지와 하위 page_javascript 스킬 간 값을 전달하는 방법

JS 상위 페이지와 하위 page_javascript 스킬 간 값을 전달하는 방법

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB원래의
2016-05-16 16:56:531994검색

1. window.open을 통해 상위 페이지가 팝업되면 하위 페이지가 나타납니다.
하위 페이지의 값을 상위 페이지로 옮기려면 window.opener를 앞에 추가하면 됩니다. 문서의.
예:
1. 상위 페이지 코드:




제목 없는 문서 제목><br>head><br><script 언어="javascript"><br>함수 tanchu() <br>{<br> window.open("Untitled-5.html") <br>}<br>script><br><body><br> <form id="form1" name=" form1 " method="post" action=""><br> onclick="tanchu ()" /><br>               label> ;/body><br></html><br>2. 하위 페이지 코드: <br> <br><html xmlns="http://www.w3.org/1999/xhtml"><br><head><br><meta http-equiv="Content-Type" content=" text/html; charset=utf-8" /></p><title>제목 없는 문서 제목><p>head><br><script 언어="javascript"><br>function aaa() <br>{<br> window.opener.document.getElementByIdx('textfield').value='123123123';<br>}<br>script><br><body><br> "form1" name=" form1" method="post" action=""><br>  <label> <input type="submit" name="button" id="button" value="Submit"<BR> onclick="aaa ()" /><br> label><br> form><br></body><br></html><br><br>둘째, 하위 페이지는 iframe입니다. 페이지 상태는 프레임 <br><br><br> 하위 페이지가 상위 페이지에 값을 전달해야 하는 경우 문서 앞에 상위를 추가하면 됩니다. <strong>1. 상위 페이지 코드: </strong> <br><html xmlns="http://www.w3.org/1999/xhtml"><br><head><br><meta http-equiv="Content-Type" content=" text/html; charset=utf-8" /></p><title>제목 없는 문서 제목><p>head><br><body><br> <form id="form1" name= " form1" method="post" action=""><br>                                                                                       ~                     <iframe id="myiframe" src="Untitled-3.html">iframe><br> 양식><br></body> <br></html><br>2. 서브 페이지 코드 <br> <br><html xmlns="http://www.w3.org/1999/xhtml"><br><head><br><meta http-equiv="Content-Type" content=" text/html; charset=utf-8" /><br><title>제목 없는 문서 제목><br>head></p><script 언어="javascript"><p>function aa() <br>{ <br> var a=parent.document.getElementByIdx('textfield').value;<br> 경고(a) <br>}<br>script><br><body><br> < ;form id="form1" name="form1" method="post" action=""><br>                                                                                                           '제출'</p></div><div class="nphpQianMsg"><div class="clear"></div></div><div class="nphpQianSheng"><span>성명:</span><div>본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.</div></div></div><div class="nphpSytBox"><span>이전 기사:<a class="dBlack" title="JavaScript는 생성자와 프로토타입을 사용하여 C# 클래스_javascript 기술의 기능을 시뮬레이션합니다." href="https://m.php.cn/ko/faq/13771.html">JavaScript는 생성자와 프로토타입을 사용하여 C# 클래스_javascript 기술의 기능을 시뮬레이션합니다.</a></span><span>다음 기사:<a class="dBlack" title="JavaScript는 생성자와 프로토타입을 사용하여 C# 클래스_javascript 기술의 기능을 시뮬레이션합니다." href="https://m.php.cn/ko/faq/13773.html">JavaScript는 생성자와 프로토타입을 사용하여 C# 클래스_javascript 기술의 기능을 시뮬레이션합니다.</a></span></div><div class="nphpSytBox2"><div class="nphpZbktTitle"><h2>관련 기사</h2><em><a href="https://m.php.cn/ko/article.html" class="bBlack"><i>더보기</i><b></b></a></em><div class="clear"></div></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><ul class="nphpXgwzList"><li><b></b><a href="https://m.php.cn/ko/faq/1609.html" title="Bootstrap 목록 그룹 구성 요소에 대한 심층 분석" class="aBlack">Bootstrap 목록 그룹 구성 요소에 대한 심층 분석</a><div class="clear"></div></li><li><b></b><a href="https://m.php.cn/ko/faq/1640.html" title="JavaScript 함수 커링에 대한 자세한 설명" class="aBlack">JavaScript 함수 커링에 대한 자세한 설명</a><div class="clear"></div></li><li><b></b><a href="https://m.php.cn/ko/faq/1949.html" title="JS 비밀번호 생성 및 강도 감지의 전체 예(데모 소스 코드 다운로드 포함)" class="aBlack">JS 비밀번호 생성 및 강도 감지의 전체 예(데모 소스 코드 다운로드 포함)</a><div class="clear"></div></li><li><b></b><a href="https://m.php.cn/ko/faq/2248.html" title="Angularjs는 WeChat UI(weui)를 통합합니다." class="aBlack">Angularjs는 WeChat UI(weui)를 통합합니다.</a><div class="clear"></div></li><li><b></b><a href="https://m.php.cn/ko/faq/2351.html" title="JavaScript를 사용하여 중국어 번체와 중국어 간체 간을 빠르게 전환하는 방법과 중국어 간체와 중국어 번체 간 전환을 지원하는 웹사이트의 요령_javascript 기술" class="aBlack">JavaScript를 사용하여 중국어 번체와 중국어 간체 간을 빠르게 전환하는 방법과 중국어 간체와 중국어 번체 간 전환을 지원하는 웹사이트의 요령_javascript 기술</a><div class="clear"></div></li></ul></div></div><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/ko/about/us.html">회사 소개</a><a href="https://m.php.cn/ko/about/disclaimer.html">부인 성명</a><a href="https://m.php.cn/ko/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></div><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>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></body><!-- Matomo --><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><!-- End Matomo Code --></html>