window.open 새로운 팝업창 만들기 질문 채택완료
응모하기라는 버튼을 만들었구요
클릭시 새로운 창을 생겨나게 하려고 하는데
만들어야될 파일들은 다 만들었고
새로운창을 생겨나게 하기 위해 common.js 에
var win_entry = function(href) {
var new_win =window.open(href,'win_entry','left=50,top=50,width=600,height=600,scrollbars=1');
new_win.focus();
}
선언했고
$(".win_entry").click(function() {
win_entry(this.href);
return false;
});
도 선언해서 function으로 선언할거 다 선언했는데
클릭하면 창이 뜨질 않습니다ㅠㅠ
뭐가 문제일까요?
답변 2개
a 태그의 href 에 값이 있으면 무조건 그 값으로 페이지 이동을 합니다
다음과 같이 해 보세요
</code></p><p><code class="plain" style="font-size: 14.004px; background-color: rgb(255, 255, 255); font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; margin: 0px !important; padding: 0px !important; border: 0px !important; outline: 0px !important; background-image: none !important; background-position: initial !important; background-size: initial !important; background-repeat: initial !important; background-attachment: initial !important; background-origin: initial !important; background-clip: initial !important; float: none !important; vertical-align: baseline !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; line-height: 1.8em !important;"><a href=</code><code class="string" style="font-size: 14.004px; background-color: rgb(255, 255, 255); font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; margin: 0px !important; padding: 0px !important; border: 0px !important; outline: 0px !important; background-image: none !important; background-position: initial !important; background-size: initial !important; background-repeat: initial !important; background-attachment: initial !important; background-origin: initial !important; background-clip: initial !important; float: none !important; vertical-align: baseline !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; line-height: 1.8em !important; color: blue !important;">"<a href="<a href="http://naver.com/" target="_blank" rel="noopener noreferrer">http://naver.com/</a>" style="text-decoration-line: none; color: blue !important;">#</a>"</code><span style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; font-size: 14.004px; background-color: rgb(255, 255, 255);"> </span><code class="keyword" style="font-size: 14.004px; background-color: rgb(255, 255, 255); font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; margin: 0px !important; padding: 0px !important; border: 0px !important; outline: 0px !important; background-image: none !important; background-position: initial !important; background-size: initial !important; background-repeat: initial !important; background-attachment: initial !important; background-origin: initial !important; background-clip: initial !important; float: none !important; vertical-align: baseline !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; line-height: 1.8em !important; font-weight: bold !important; color: rgb(0, 102, 153) !important;">class</code><code class="plain" style="font-size: 14.004px; background-color: rgb(255, 255, 255); font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; margin: 0px !important; padding: 0px !important; border: 0px !important; outline: 0px !important; background-image: none !important; background-position: initial !important; background-size: initial !important; background-repeat: initial !important; background-attachment: initial !important; background-origin: initial !important; background-clip: initial !important; float: none !important; vertical-align: baseline !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; line-height: 1.8em !important;">=</code><code class="string" style="font-size: 14.004px; background-color: rgb(255, 255, 255); font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; margin: 0px !important; padding: 0px !important; border: 0px !important; outline: 0px !important; background-image: none !important; background-position: initial !important; background-size: initial !important; background-repeat: initial !important; background-attachment: initial !important; background-origin: initial !important; background-clip: initial !important; float: none !important; vertical-align: baseline !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; line-height: 1.8em !important; color: blue !important;">"win_entry" data-url="이동할 페이지 URL"</code><code class="plain" style="font-size: 14.004px; background-color: rgb(255, 255, 255); font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; margin: 0px !important; padding: 0px !important; border: 0px !important; outline: 0px !important; background-image: none !important; background-position: initial !important; background-size: initial !important; background-repeat: initial !important; background-attachment: initial !important; background-origin: initial !important; background-clip: initial !important; float: none !important; vertical-align: baseline !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; line-height: 1.8em !important;">>응모하기</a></code> </p><p><script></p><p><span style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; font-size: 14.004px; background-color: rgb(255, 255, 255);">// 다른곳에서 쓸일이 없으면 삭제하고 함수안에 var new_win = window.open.. 으로 변경</span> </p><p><code class="plain" style="font-size: 14.004px; background-color: rgb(255, 255, 255); font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; margin: 0px !important; padding: 0px !important; border: 0px !important; outline: 0px !important; background-image: none !important; background-position: initial !important; background-size: initial !important; background-repeat: initial !important; background-attachment: initial !important; background-origin: initial !important; background-clip: initial !important; float: none !important; vertical-align: baseline !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; line-height: 1.8em !important;"><span style="color: rgb(72, 72, 72); font-family: Arial, 돋움, Dotum; font-size: 14.004px;">var new_win = null;</span> </code></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: Arial, 돋움, Dotum; font-size: 14.004px;">$(".win_entry").on('click', function() {</p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: Arial, 돋움, Dotum; font-size: 14.004px;"> <span style="white-space: pre;"> </span><span style="font-size: 14.004px;">new_win = window.open($(this).attr('data-url'), 'win_entry', 'left=50,top=50,width=600,height=600,scrollbars=1');</span></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: Arial, 돋움, Dotum; font-size: 14.004px;"> new_win.focus();</p><p><code class="plain" style="font-size: 14.004px; background-color: rgb(255, 255, 255); font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; margin: 0px !important; padding: 0px !important; border: 0px !important; outline: 0px !important; background-image: none !important; background-position: initial !important; background-size: initial !important; background-repeat: initial !important; background-attachment: initial !important; background-origin: initial !important; background-clip: initial !important; float: none !important; vertical-align: baseline !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; line-height: 1.8em !important;"></code></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: Arial, 돋움, Dotum; font-size: 14.004px;"> });</p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: Arial, 돋움, Dotum; font-size: 14.004px;"><span style="color: rgb(0, 0, 0); font-family: 돋움; font-size: 14.6667px;"></script></span> </p><p><span style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; font-size: 14.004px; background-color: rgb(255, 255, 255);">
댓글을 작성하려면 로그인이 필요합니다.
혹시...
응모하기 버튼에
</p><p><a href="<a href="<a href="http://naver.com" target="_blank" rel="noopener noreferrer">http://naver.com</a>"><a href="http://naver.com" target="_blank" rel="noopener noreferrer">http://naver.com</a></a>" class="<span style="color: rgb(72, 72, 72); font-family: Arial, 돋움, Dotum; font-size: 14.004px;">win_entry">응모하기</a></span></p><p><span style="color: rgb(72, 72, 72); font-family: Arial, 돋움, Dotum; font-size: 14.004px;">
</span></p><p><span style="color: rgb(72, 72, 72); font-family: Arial, 돋움, Dotum; font-size: 14.004px;">
이런식으로
class 가 선언되어있나요?
함수를 보면
win_entry(this.href);
가 있는것으로 보아
<a> 태그에
href
와
class 가 필수로 존재해야 할것 같은데요
한번 확인해보세요
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인