2016-10-15 3 views
0

지금 팝업과 관련된 문제가 있습니다. 나는 이미지가있는 팝업이 있기를 원하지만, 모든 팝업은 목록의 마지막 팝업 이미지 (이 경우에는 20 번째 이미지) 만 표시합니다. 검색 한 결과 newWindow.document.write(text);에 오류가 있다는 메시지가 표시되지만 setTimeout(function()과 관련이있을 수 있습니다. 너희들이 나를 도울 수 있기를. 그래서 당신의 문제는 당신이 HTML 팝업에 표시 할 만들 때, 당신은 "텍스트"라는 이름을이었다,자바 스크립트에서 팝업과 관련된 문제

<HEAD> 
 
<title>PopUp</title> 
 

 
<SCRIPT LANGUAGE="JavaScript"> 
 
function popups(){popupWin1();popupWin2();popupWin3();popupWin4();popupWin5();popupWin6();popupWin7();popupWin8();popupWin9();popupWin10();popupWin11();popupWin12();popupWin13();popupWin14();popupWin15();popupWin16();popupWin17();popupWin18();popupWin19();popupWin20();} 
 
function popupWin1() { 
 

 
text = "<html>\n<head>\n<title></title>\n<body bgcolor=black><img STYLE=position:absolute; TOP:0px; LEFT:6px; HEIGHT:100% src=giphy4.gif style=height:100%></body>\n</html>\n"; 
 
setTimeout(function() 
 
{ 
 
newWindow = window.open('','newWin1','width=800,height=400,left=100,top=100,'); 
 
newWindow.document.write(text); 
 
}, 1000); 
 
// time delay of pop-ups 
 
} 
 

 
function popupWin2() { 
 

 
text = "<html>\n<head>\n<title></title>\n<body bgcolor=black><img STYLE=position:absolute; TOP:0px; LEFT:0px; src=tumblr_o4j9rpai7K1tj7oyqo1_500.gif style=height:100%;></body>\n</html>\n"; 
 
setTimeout(function() 
 
{ 
 
newWindow = window.open('','newWin2','width=900,height=800,left=700,top=600,'); 
 
newWindow.document.write(text); 
 
}, 5000) 
 

 
} 
 

 
function popupWin3() { 
 

 
text = "<html>\n<head>\n<title></title>\n<body bgcolor=black><img STYLE=position:absolute; TOP:0px; LEFT:0px; src=randycano_pre.gif style=height:100% width=100%;></body>\n</html>\n"; 
 
setTimeout(function() 
 
{ 
 
newWindow = window.open('','newWin3','width=400,height=600,left=30,top=400,'); 
 
newWindow.document.write(text); 
 
}, 10500) 
 

 
} 
 

 
function popupWin4() { 
 

 
text = "<html>\n<head>\n<title></title>\n<body bgcolor=black><img STYLE=position:absolute; TOP:0px; LEFT:0px; src=giphy.gif style=height:100% width=100%;></body>\n</html>\n"; 
 
setTimeout(function() 
 
{ 
 
newWindow = window.open('','newWin4','width=1000,height=800,left=500,top=100,'); 
 
newWindow.document.write(text); 
 
}, 15500) 
 

 
} 
 

 
function popupWin5() { 
 

 
text = "<html>\n<head>\n<title></title>\n<body bgcolor=black><img STYLE=position:absolute; TOP:0px; LEFT:0px; src=tumblr_o2w65pSscx1uluhv2o1_500.gif style=height:100% width=100%;></body>\n</html>\n"; 
 
setTimeout(function() 
 
{ 
 
newWindow = window.open('','newWin5','width=800,height=500,left=600,top=400,'); 
 
newWindow.document.write(text); 
 
}, 17500) 
 

 
} 
 

 
function popupWin6() { 
 

 
text = "<html>\n<head>\n<title></title>\n<body bgcolor=black><img STYLE=position:absolute; TOP:0px; LEFT:0px; src=BelovedVacantChihuahua-size_restricted.gif style=height:100% width=100%;></body>\n</html>\n"; 
 
setTimeout(function() 
 
{ 
 
newWindow = window.open('','newWin6','width=700,height=450,left=200,top=700,'); 
 
newWindow.document.write(text); 
 
}, 20000) 
 

 
} 
 

 
function popupWin7() { 
 

 
text = "<html>\n<head>\n<title></title>\n<body bgcolor=black><img STYLE=position:absolute; TOP:0px; LEFT:0px; src=giphy2.gif style=height:100% width=100%;></body>\n</html>\n"; 
 
setTimeout(function() 
 
{ 
 
newWindow = window.open('','newWin7','width=450,height=750,left=400,top=400,'); 
 
newWindow.document.write(text); 
 
}, 22000) 
 

 
} 
 

 
function popupWin8() { 
 

 
text = "<html>\n<head>\n<title></title>\n<body bgcolor=black><img STYLE=position:absolute; TOP:0px; LEFT:0px; src=rcano1.gif style=height:100% width=100%;></body>\n</html>\n"; 
 
setTimeout(function() 
 
{ 
 
newWindow = window.open('','newWin8','width=900,height=400,left=550,top=500,'); 
 
newWindow.document.write(text); 
 
}, 27000) 
 

 
} 
 

 
function popupWin9() { 
 

 
text = "<html>\n<head>\n<title></title>\n<body bgcolor=black><img STYLE=position:absolute; TOP:0px; LEFT:0px; src=jelly-gummies-db-test-01.gif style=height:100% width=100%;></body>\n</html>\n"; 
 
setTimeout(function() 
 
{ 
 
newWindow = window.open('','newWin9','width=850,height=670,left=450,top=600,'); 
 
newWindow.document.write(text); 
 
}, 33500) 
 

 
} 
 

 
function popupWin10() { 
 

 
text = "<html>\n<head>\n<title></title>\n<body bgcolor=black><img STYLE=position:absolute; TOP:0px; LEFT:0px; src=giphy3.gif style=height:100% width=100%;></body>\n</html>\n"; 
 
setTimeout(function() 
 
{ 
 
newWindow = window.open('','newWin10','width=550,height=600,left=150,top=100,'); 
 
newWindow.document.write(text); 
 
}, 36000) 
 

 
} 
 

 
function popupWin11() { 
 

 
text = "<html>\n<head>\n<title></title>\n<body bgcolor=black><img STYLE=position:absolute; TOP:0px; LEFT:0px; src=9897574_one-year-of-gifs--gif-six-pack_t4d3d6bfc.gif style=height:100% width=100%;></body>\n</html>\n"; 
 
setTimeout(function() 
 
{ 
 
newWindow = window.open('','newWin11','width=400,height=900,left=750,top=700,'); 
 
newWindow.document.write(text); 
 
}, 39500) 
 

 
} 
 

 
function popupWin12() { 
 

 
text = "<html>\n<head>\n<title></title>\n<body bgcolor=black><img STYLE=position:absolute; TOP:0px; LEFT:0px; src=giphy4.gif style=height:100% width=100%;></body>\n</html>\n"; 
 
setTimeout(function() 
 
{ 
 
newWindow = window.open('','newWin12','width=500,height=900,left=350,top=100,'); 
 
newWindow.document.write(text); 
 
}, 42000) 
 

 
} 
 

 
function popupWin13() { 
 

 
text = "<html>\n<head>\n<title></title>\n<body bgcolor=black><img STYLE=position:absolute; TOP:0px; LEFT:0px; src=200.gif style=height:100% width=100%;></body>\n</html>\n"; 
 
setTimeout(function() 
 
{ 
 
newWindow = window.open('','newWin13','width=500,height=650,left=850,top=700,'); 
 
newWindow.document.write(text); 
 
}, 45500) 
 

 
} 
 

 
function popupWin14() { 
 

 
text = "<html>\n<head>\n<title></title>\n<body bgcolor=black><img STYLE=position:absolute; TOP:0px; LEFT:0px; src=giphy5.gif style=height:100% width=100%;></body>\n</html>\n"; 
 
setTimeout(function() 
 
{ 
 
newWindow = window.open('','newWin14','width=500,height=650,left=50,top=250,'); 
 
newWindow.document.write(text); 
 
}, 47600) 
 

 
} 
 

 
function popupWin15() { 
 

 
text = "<html>\n<head>\n<title></title>\n<body bgcolor=black><img STYLE=position:absolute; TOP:0px; LEFT:0px; src=201.gif style=height:100% width=100%;></body>\n</html>\n"; 
 
setTimeout(function() 
 
{ 
 
newWindow = window.open('','newWin15','width=500,height=750,left=50,top=200,'); 
 
newWindow.document.write(text); 
 
}, 48700) 
 

 
} 
 

 
function popupWin16() { 
 

 
text = "<html>\n<head>\n<title></title>\n<body bgcolor=black><img STYLE=position:absolute; TOP:0px; LEFT:0px; src=202.gif style=height:100% width=100%;></body>\n</html>\n"; 
 
setTimeout(function() 
 
{ 
 
newWindow = window.open('','newWin16','width=500,height=500,left=150,top=0,'); 
 
newWindow.document.write(text); 
 
}, 49800) 
 

 
} 
 

 
function popupWin17() { 
 

 
text = "<html>\n<head>\n<title></title>\n<body bgcolor=black><img STYLE=position:absolute; TOP:0px; LEFT:0px; src=giphy2.gif style=height:100% width=100%;></body>\n</html>\n"; 
 
setTimeout(function() 
 
{ 
 
newWindow = window.open('','newWin17','width=500,height=700,left=350,top=100,'); 
 
newWindow.document.write(text); 
 
}, 50850) 
 

 
} 
 

 
function popupWin18() { 
 

 
text = "<html>\n<head>\n<title></title>\n<body bgcolor=black><img STYLE=position:absolute; TOP:0px; LEFT:0px; src=202.gif style=height:100% width=100%;></body>\n</html>\n"; 
 
setTimeout(function() 
 
{ 
 
newWindow = window.open('','newWin18','width=500,height=600,left=0,top=800,'); 
 
newWindow.document.write(text); 
 
}, 51900) 
 

 
} 
 

 
function popupWin19() { 
 

 
text = "<html>\n<head>\n<title></title>\n<body bgcolor=yellow><img STYLE=position:absolute; TOP:0px; LEFT:0px; src=giphy4.gif style=height:100% width=100%;></body>\n</html>\n"; 
 
setTimeout(function() 
 
{ 
 
newWindow = window.open('','newWin19','width=500,height=620,left=30,top=0,'); 
 
newWindow.document.write(text); 
 
}, 52950) 
 

 
} 
 

 
function popupWin20() { 
 

 
text = "<html>\n<head>\n<title></title>\n<body bgcolor=yellow><img STYLE=position:absolute; TOP:0px; LEFT:0px; src=randy-cano-melting-motion-graphics-animation-designboom-818_2.gif style=height:100%;></body>\n</html>\n"; 
 
setTimeout(function() 
 
{ 
 
newWindow = window.open('','newWin20','width=500,height=400,left=650,top=400,'); 
 
newWindow.document.write(text); 
 
}, 54000) 
 

 
} 
 

 
</script> 
 

 
</HEAD> 
 

 
<BODY onLoad="popups()">

+0

주요 문제를하는 데 도움이 그들이 성가신 이런 종류의 물건을 차단대로 현대의 브라우저에서 작동하지 않을 것입니다 바랍니다. 다른 한편으로는, 그것은 코드가 1998 년에 작성된 것처럼 보입니다. 그래서 아마도 deLorean을 차고에서 꺼낼 시간입니다. – adeneo

답변

0

오른쪽 :

는 코드입니다. 그리고 매번 그 텍스트를 호출하여 본질적으로 첫 번째 HTML을 반복해서 호출합니다.

newWindow.document.write(text); 

위의 행은 20 번 있습니다. 로 변경 :

-- CODE -- 
newWindow.document.write(text1); 
-- CODE -- 
newWindow.document.write(text2); 
-- CODE -- 
newWindow.document.write(text3); 
-- CODE -- 

나는 코드 조금 양식에 일치시키는, 그리고 그것을 잘 작동합니다. 보세요 :

function popups(){popupWin1();popupWin2()} 
    function popupWin1() { 

     text = "<html>" + 
       "<head>" + 
       "<title></title>" + 
       "<body bgcolor=black>" + 
       "<img STYLE=position:absolute; " + 
       "TOP:0px; LEFT:6px; HEIGHT:100% " + 
       "src='http://cdn.sstatic.net/Sites/stackoverflow/company/img/logos/so/so-icon.png?v=c78bd457575a' " + 
       "style=height:100%>" + 
       "</body>" + 
       "</html>"; 
     setTimeout(function() 
     { 
      newWindow = window.open('','newWin1','width=800,height=400,left=100,top=100,'); 
      newWindow.document.write(text); 
     }, 1000); 
    } 
    function popupWin2() { 

     text2 = "<html>" + 
       "<head>" + 
       "<title></title>" + 
       "<body bgcolor=black>" + 
       "<img STYLE=position:absolute; " + 
       "TOP:0px; LEFT:6px; HEIGHT:100% " + 
       "src='https://www.w3.org/html/logo/downloads/HTML5_Logo_512.png' " + 
       "style=height:100%>" + 
       "</body>" + 
       "</html>"; 
     setTimeout(function() 
     { 
      newWindow = window.open('','newWin2','width=800,height=400,left=100,top=100,'); 
      newWindow.document.write(text2); 
     }, 1000); 
    } 

내가 즉,이와

+0

감사합니다. 이것은 많은 도움이됩니다. :) – nelis96

+0

감사합니다. 이것은 많은 도움이됩니다. :) – nelis96

관련 문제