웹마스터 팁


맨날 하는 짓거리가 글씀다.
모 티비 프로그램에 가로 세칸 세로 세칸에 연예인 사진 뜨면서
가로 열 혹은 세로열 혹은 대각선이 같은 성별로 이루어진 열이
몇개인지 알아맞추는 스크립트임다.


뭐 말은 뻔듯하게 '학습용'으로 쓰시길 권합니다.


미리 보기 : http://allzza.net/xxx/aboard.php?id=pds&mode=source&dbf=21




<html>
<title>
개판 오분전 뷩고~~~
</title>

<head>

<script>
/****************************************
몹시 심심했던 12월 어느 날(유명한 모 인사 생일 전야라고 하던데...)
미친개 맹글다.
맘껏 소스 도용해도 괜찮음.
****************************************/

var basic_img = "http://www.nzeo.com/images/main/top_logo.gif"; //- 기본 이미지
var img_url = new Array(                //-- 랜덤으로 추출할 이미지 주소
    new Array("http://is.nate.com/00/59/89/00598941_2.jpg","남"),
    new Array("http://is.nate.com/00/58/11/00581148_2.jpg","남"),
    new Array("http://is.nate.com/00/35/67/00356732_2.jpg","남"),
    new Array("http://is.nate.com/00/58/27/00582742_2.jpg","남"),
    new Array("http://is.nate.com/00/39/75/00397524_2.jpg","남"),
    new Array("http://is.nate.com/00/60/22/00602281_2.jpg","남"),
    new Array("http://is.nate.com/00/59/96/00599624_2.jpg","남"),
    new Array("http://is.nate.com/00/49/87/00498775_2.jpg","남"),
    new Array("http://is.nate.com/00/55/92/00559245_2.jpg","남"),

    new Array("http://is.nate.com/00/58/97/00589779_2.jpg","여"),
    new Array("http://is.nate.com/00/59/26/00592643_2.jpg","여"),
    new Array("http://is.nate.com/00/57/58/00575851_2.jpg","여"),
    new Array("http://is.nate.com/00/60/12/00601208_2.jpg","여"),
    new Array("http://is.nate.com/00/49/80/00498055_2.jpg","여"),
    new Array("http://is.nate.com/00/60/43/00604366_2.jpg","여"),
    new Array("http://is.nate.com/00/60/18/00601808_2.jpg","여"),
    new Array("http://is.nate.com/00/60/01/00600190_2.jpg","여"),
    new Array("http://is.nate.com/00/60/43/00604352_2.jpg","여"),
    new Array("http://is.nate.com/00/55/50/00555095_2.jpg","여")
    );

var bingo_array = new Array( //-- 빙고가 되는 경우
    new Array(0,1,2), new Array(3,4,5), new Array(6,7,8),
    new Array(0,3,6), new Array(1,4,7), new Array(2,5,8),
    new Array(0,4,8), new Array(2,4,6)
    );
flag = false;
time_intaval = false;

function on_load_()   {       //-- 기본 이미지로 이미지를 채움
    for(i=0;i<9;i++)   {
         myObj = eval("document.images.im" + i);
         myObj.src = basic_img;
         }
    }

function img_load()  {    //-- 게임 시작시 이미지를 로딩함
    sex_array = new Array();
    dd_time = new Date();
    time_intaval = false;
    for(j=0;j<9;j++)  {
       sel_img = Math.floor(Math.random() * img_url.length);
       imgObj = eval("document.images.im" + j);
       imgObj.src = img_url[sel_img][0];
       sex_array[j] = img_url[sel_img][1];
       }
    time_intaval = setInterval("write_text()",500);
    bing_count = comp();
    document.bb.dc.focus();
    }
    
function write_text()   { //--걸린 시간을 텍스트에 뿌려주는 함수
    int_time = new Date();
    if(flag)   {
         document.bb.dtime.value = Math.floor((int_time - dd_time)/1000) + "초";
         flag = false;
         }
    else {
         document.bb.dtime.value = "";
         flag = true;
         }
    }
    
function comp()   {  //-- 빙고 갯수를 돌려줌
   ret_val = 0;
   for(k=0;k<bingo_array.length;k++)   {
              if(sex_array[bingo_array[k][0]] == sex_array[bingo_array[k][1]] && sex_array[bingo_array[k][0]] == sex_array[bingo_array[k][2]]) ret_val++;
              }  
   return ret_val;
   }    
  
function _submit()    {   //-- 빙고줄 갯수를 입력하고 버튼을 눌렀을때 실행하는 함수
    if(document.bb.dc.value == bing_count) {
        clearTimeout(time_intaval);
        //on_load_();
        if(confirm("한번 더...O,K?")) reset_();
        else on_load_();
        }
    else  {
            alert("ㅡ,.ㅡ");
            document.bb.dc.value = ""; document.bb.dc.focus();
            }
    }
    
function reset_()  {   //-- 게임의 리셋
    flag = false;
    if(time_intaval) clearTimeout(time_intaval);
    img_load();
    }
</script>


<body onload='javascript:on_load_()'>

<center>
<table width=600 height=450 border=1>
<tr>
<td width=200 height=150>
<img width=200 height=150 name=im0>
</td>
<td width=200 height=150>
<img width=200 height=150 name=im1>
</td>
<td width=200 height=150>
<img width=200 height=150 name=im2>
</td>
</tr>

<tr>
<td width=200 height=150>
<img width=200 height=150 name=im3>
</td>
<td width=200 height=150>
<img width=200 height=150 name=im4>
</td>
<td width=200 height=150>
<img width=200 height=150 name=im5>
</td>
<tr>
</tr>
<td width=200 height=150>
<img width=200 height=150 name=im6>
</td>
<td width=200 height=150>
<img width=200 height=150 name=im7>
</td>
<td width=200 height=150>
<img width=200 height=150 name=im8>
</td>
</tr>
<tr>
<td align=left colspan=3>
<form name=bb>
<b>빙고 갯수 : </b><input type=text name=dc size=3>
<input type=button value="입력" onclick='javascript:_submit()'><br>
<b>걸린 시간 : </b><input type=text name=dtime size=20 readonly><br>
<input type=button value="게임 시작" onclick='javascript:img_load()'>
<input type=button value="reset" onclick='javascript:reset_()'>
</form>
</td>
</tr>
</table>
</center>
</body>
</html>
제목 글쓴이 날짜
Javascript + 플래시 칼라피커 [6] 행복한고니 2004.10.08
체크박스를 이미지로 사용하기 [7] 행복한고니 2004.10.10
배열 스크립트 종합선물세트 행복한고니 2004.10.12
멀티 파일다운로드 꼼수 (새창버전) [1] 행복한고니 2004.10.14
XP2인지 체크하여 XP2일때는 팝업허용하라는 메시지 뛰워주기 [3] 아돌 2004.10.19
모든 이미지, 텍스트 링크에 점선 없애기 [5] 이강민 2004.10.25
JavaScript 구문강조 효과내기 파우링 2004.10.28
행복한고니님의 체크박스를 이미지로 사용하기를 보고... 체크박스옆에 텍스트 부치기 [2] beMax 2004.10.29
ActiveX 멀티파일업로더 입니다. [9] by風 2004.11.01
홈페이지 나갈때 새창띄우기 [2] piasol 2004.11.07
(수정)배경음악,연월일,시간, 코멘트 셋트.(AM,PM==>오전,오후 순,한국식으로 ...) [4] 민피디 2004.11.10
ActiveX 플래시 이미지캡쳐 컨트롤 iFlower [1] 덴디 2004.11.15
iFlower 윈도우리스 플래시 ActiveX 컨트롤 덴디 2004.11.16
자바스크립트 암호화 [5] 손상모 2004.11.18
로딩중인 페이지에 효과넣기 [4] LUFFY 2004.11.20
이미지 를 브라우져에서 내맘데로 옮겨두기 [8] piasol 2004.12.03
이제 미디어플레이어는 가라? 곰플레이어로 실시간으로 감상하자. [13] ⓣing★™ 2004.12.05
홈페이지를 풀스크린으로 띄우자 - 올플래시로 보이는군요. [21] Multi_Taeji 2004.12.10
마우스를 대면 이미지가 바뀐다. 롤오버 이미지 [3] 하진 2004.12.19
개판 오분전 빙고 [2] 미친개 2004.12.30