2014-09-25 2 views
0

자바 스크립트 :이 scirpt 만 같은 탭 또는 창에서 구글로 이동Alert Box (알리미 상자) : 확인을 클릭하고 다른 웹 사이트에 새로운 broswer 창을 표시합니다. 어떻게? 같은

<script type="text/javascript"> 
if(!alert("msg here ")) document.location = 'http://google.com'; 
</script> 

, 나는 다음 google.com으로 이동 창을 강아지 싶습니다. 감사합니다. .

+1

는'window.open ("http://google.com", "", "폭 = 200을 시도, height = 100 ")' –

+0

@TamilSelvan 당신이 나를 때려 눕히다! 문서 : [MDN에서] (https://developer.mozilla.org/en-US/docs/Web/API/Window.open) – lucusp

+0

또한 btw 중복 : http://stackoverflow.com/questions/9394131/go -to-url-after-ok-button-in-alert-pressed- – icecub

답변

0

비우호적 방법 :

<script type="text/javascript"> 
if(!alert("msg here")) window.open("http://google.com"); 
</script> 

더 친화적 인 방법 :

<script type="text/javascript"> 
if(confirm("Do you wish to go to google?")) window.open("http://google.com"); 
</script> 
+0

님을 차단했습니다. 그걸 해결하는 법, 고마워. – yzz

+0

크롬에서 팝업 차단기를 사용 중지합니다. https://productforums.google.com/forum/#!topic/chrome/m-WfaAOYRyA – icecub

+0

감사합니다.하지만 내 친구들에게 팝업이 계속 표시되도록하는 방법은 무엇입니까? :) – yzz

관련 문제