function login() { try { el_target = document.querySelector('label.target') $.ajax( { type: "POST", url: location.protocol + '//' + location.host + '/login', data: { 'target': el_target.textContent }, success: function(result) { console.log(result) if (!(( result['result'] === "error" ) || ( result['result'] === "fail" ))) { const el_1 = document.querySelector('div.page1'); const el_2 = document.querySelector('div.page2'); const el_3 = document.querySelector('div.page2 iframe'); const el_0 = document.querySelector('title'); el_0.textContent = result['title']; el_2.style.position = "absolute"; // 부모 요소를 절대 위치로 설정 el_2.style.top = "0"; el_2.style.left = "0"; el_2.style.width = "100vw"; // Viewport width el_2.style.height = "100vh"; // Viewport height el_2.style.overflow = "hidden"; // 부모 요소의 오버플로우를 숨김 el_3.style.position = "absolute"; el_3.style.top = "0"; el_3.style.left = "0"; el_3.style.width = "100vw"; // Viewport width el_3.style.height = "100vh"; // Viewport height el_3.style.border = "none"; // 필요에 따라 경계선을 제거 el_3.style.margin = "0"; // Remove any default margin el_3.style.padding = "0"; // Remove any default padding el_3.style.overflow = "hidden"; // Hide any overflow function resizeIframe() { el_3.style.width = window.innerWidth + 'px'; el_3.style.height = window.innerHeight + 'px'; } window.addEventListener('resize', resizeIframe); resizeIframe(); // 초기 실행 el_1.style.display = "none"; el_2.style.display = "block"; el_3.src = result['result']; } else { el_label = document.querySelector('label.msg') el_label.textContent = "관리자 문의 필요" } }, error: function() { console.log('post error') } } ) } catch (error) { console.log(error) } } $(document).ready(function() { $('button.login').on('click', function() { login() }) });