갤러리 스크립트 조언부탁드립니다. > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

갤러리 스크립트 조언부탁드립니다. 정보

갤러리 스크립트 조언부탁드립니다.

본문

<table width="640" height="520" border="0" align='center' cellpadding="0" cellspacing="0" bgcolor="#ECECEC">

 <tr>
    <td colspan="10" height="470" valign="top"><div align="left"><img src="<?=$g4['path']?>/data/file/<?=$bo_table?>/<?=$view[file][0][file]?>" width="640" height="470" border="0" align="middle" id=orgin_img></div></td>
  <tr>
    <td width="64" height="50" bgcolor='#ECECEC' onMouseOver="bgColor='#eaeaea'" onMouseOut="bgColor='#ECECEC'"><div align="center"><img onclick="ch_img('fimg1');" id=fimg1 src="<?=$g4['path']?>/data/file/<?=$bo_table?>/<?=$view[file][0][file]?>" width="64" height="46" border="0" style="cursor:hand;"></div></td>
    <td width="64" height="50" bgcolor='#ECECEC' onMouseOver="bgColor='#eaeaea'" onMouseOut="bgColor='#ECECEC'"><div align="center"><img onclick="ch_img('fimg2');" id=fimg2 src="<?=$g4['path']?>/data/file/<?=$bo_table?>/<?=$view[file][1][file]?>" width="64" height="46" border="0" style="cursor:hand;"></div></td>
    <td width="64" height="50" bgcolor='#ECECEC' onMouseOver="bgColor='#eaeaea'" onMouseOut="bgColor='#ECECEC'"><div align="center"><img onclick="ch_img('fimg3');" id=fimg3 src="<?=$g4['path']?>/data/file/<?=$bo_table?>/<?=$view[file][2][file]?>" width="64" height="46" border="0" style="cursor:hand;"></div></td>
    <td width="64" height="50" bgcolor='#ECECEC' onMouseOver="bgColor='#eaeaea'" onMouseOut="bgColor='#ECECEC'"><div align="center"><img onclick="ch_img('fimg4');" id=fimg4 src="<?=$g4['path']?>/data/file/<?=$bo_table?>/<?=$view[file][3][file]?>" width="64" height="46" border="0" style="cursor:hand;"></div></td>
    <td width="64" height="50" bgcolor='#ECECEC' onMouseOver="bgColor='#eaeaea'" onMouseOut="bgColor='#ECECEC'"><div align="center"><img onclick="ch_img('fimg5');" id=fimg5 src="<?=$g4['path']?>/data/file/<?=$bo_table?>/<?=$view[file][4][file]?>" width="64" height="46" border="0" style="cursor:hand;"></div></td>
    <td width="64" height="50" bgcolor='#ECECEC' onMouseOver="bgColor='#eaeaea'" onMouseOut="bgColor='#ECECEC'"><div align="center"><img onclick="ch_img('fimg6');" id=fimg6 src="<?=$g4['path']?>/data/file/<?=$bo_table?>/<?=$view[file][5][file]?>" width="64" height="46" border="0" style="cursor:hand;"></div></td>
    <td width="64" height="50" bgcolor='#ECECEC' onMouseOver="bgColor='#eaeaea'" onMouseOut="bgColor='#ECECEC'"><div align="center"><img onclick="ch_img('fimg7');" id=fimg7 src="<?=$g4['path']?>/data/file/<?=$bo_table?>/<?=$view[file][6][file]?>" width="64" height="46" border="0" style="cursor:hand;"></div></td>
    <td width="64" height="50" bgcolor='#ECECEC' onMouseOver="bgColor='#eaeaea'" onMouseOut="bgColor='#ECECEC'"><div align="center"><img onclick="ch_img('fimg8');" id=fimg8 src="<?=$g4['path']?>/data/file/<?=$bo_table?>/<?=$view[file][7][file]?>" width="64" height="46" border="0" style="cursor:hand;"></div></td>
    <td width="64" height="50" bgcolor='#ECECEC' onMouseOver="bgColor='#eaeaea'" onMouseOut="bgColor='#ECECEC'"><div align="center"><img onclick="ch_img('fimg9');" id=fimg9 src="<?=$g4['path']?>/data/file/<?=$bo_table?>/<?=$view[file][8][file]?>" width="64" height="46" border="0" style="cursor:hand;"></div></td>
<td width="64" height="50" bgcolor='#ECECEC' onMouseOver="bgColor='#eaeaea'" onMouseOut="bgColor='#ECECEC'"><div align="center"><img onclick="ch_img('fimg10');" id=fimg10 src="<?=$g4['path']?>/data/file/<?=$bo_table?>/<?=$view[file][9][file]?>" width="64" height="46" border="0" style="cursor:hand;"></div></td>
    <td width="64" height="50" bgcolor='#ECECEC' onMouseOver="bgColor='#eaeaea'" onMouseOut="bgColor='#ECECEC'">&nbsp;</td>
    </tr>
</table>
<!--------------- 여기까지 view1 -------------------------------------//------->



<table width="640" height="520" border="0" align='center' cellpadding="0" cellspacing="0" bgcolor="#ECECEC">

  <tr>
    <td colspan="10" height="470" valign="top"><div align="left"><img src="<?=$g4['path']?>/data/file/<?=$bo_table?>/<?=$view[file][10][file]?>" width="640" height="470" border="0" align="middle" id=orgin_img></div></td>
  <tr>
    <td width="64" height="50" bgcolor='#ECECEC' onMouseOver="bgColor='#eaeaea'" onMouseOut="bgColor='#ECECEC'"><div align="center"><img onclick="ch_img('fimg11');" id=fimg11 src="<?=$g4['path']?>/data/file/<?=$bo_table?>/<?=$view[file][10][file]?>" width="64" height="46" border="0" style="cursor:hand;"></div></td>
    <td width="64" height="50" bgcolor='#ECECEC' onMouseOver="bgColor='#eaeaea'" onMouseOut="bgColor='#ECECEC'"><div align="center"><img onclick="ch_img('fimg12');" id=fimg12 src="<?=$g4['path']?>/data/file/<?=$bo_table?>/<?=$view[file][11][file]?>" width="64" height="46" border="0" style="cursor:hand;"></div></td>
    <td width="64" height="50" bgcolor='#ECECEC' onMouseOver="bgColor='#eaeaea'" onMouseOut="bgColor='#ECECEC'"><div align="center"><img onclick="ch_img('fimg13');" id=fimg13 src="<?=$g4['path']?>/data/file/<?=$bo_table?>/<?=$view[file][12][file]?>" width="64" height="46" border="0" style="cursor:hand;"></div></td>
    <td width="64" height="50" bgcolor='#ECECEC' onMouseOver="bgColor='#eaeaea'" onMouseOut="bgColor='#ECECEC'"><div align="center"><img onclick="ch_img('fimg14');" id=fimg14 src="<?=$g4['path']?>/data/file/<?=$bo_table?>/<?=$view[file][13][file]?>" width="64" height="46" border="0" style="cursor:hand;"></div></td>
    <td width="64" height="50" bgcolor='#ECECEC' onMouseOver="bgColor='#eaeaea'" onMouseOut="bgColor='#ECECEC'"><div align="center"><img onclick="ch_img('fimg15');" id=fimg15 src="<?=$g4['path']?>/data/file/<?=$bo_table?>/<?=$view[file][14][file]?>" width="64" height="46" border="0" style="cursor:hand;"></div></td>
    <td width="64" height="50" bgcolor='#ECECEC' onMouseOver="bgColor='#eaeaea'" onMouseOut="bgColor='#ECECEC'"><div align="center"><img onclick="ch_img('fimg16');" id=fimg16 src="<?=$g4['path']?>/data/file/<?=$bo_table?>/<?=$view[file][15][file]?>" width="64" height="46" border="0" style="cursor:hand;"></div></td>
    <td width="64" height="50" bgcolor='#ECECEC' onMouseOver="bgColor='#eaeaea'" onMouseOut="bgColor='#ECECEC'"><div align="center"><img onclick="ch_img('fimg17');" id=fimg17 src="<?=$g4['path']?>/data/file/<?=$bo_table?>/<?=$view[file][16][file]?>" width="64" height="46" border="0" style="cursor:hand;"></div></td>
    <td width="64" height="50" bgcolor='#ECECEC' onMouseOver="bgColor='#eaeaea'" onMouseOut="bgColor='#ECECEC'"><div align="center"><img onclick="ch_img('fimg18');" id=fimg18 src="<?=$g4['path']?>/data/file/<?=$bo_table?>/<?=$view[file][17][file]?>" width="64" height="46" border="0" style="cursor:hand;"></div></td>
    <td width="64" height="50" bgcolor='#ECECEC' onMouseOver="bgColor='#eaeaea'" onMouseOut="bgColor='#ECECEC'"><div align="center"><img onclick="ch_img('fimg19');" id=fimg19 src="<?=$g4['path']?>/data/file/<?=$bo_table?>/<?=$view[file][18][file]?>" width="64" height="46" border="0" style="cursor:hand;"></div></td>
<td width="64" height="50" bgcolor='#ECECEC' onMouseOver="bgColor='#eaeaea'" onMouseOut="bgColor='#ECECEC'"><div align="center"><img onclick="ch_img('fimg20');" id=fimg20 src="<?=$g4['path']?>/data/file/<?=$bo_table?>/<?=$view[file][19][file]?>" width="64" height="46" border="0" style="cursor:hand;"></div></td>
    <td width="64" height="50" bgcolor='#ECECEC' onMouseOver="bgColor='#eaeaea'" onMouseOut="bgColor='#ECECEC'">&nbsp;</td>
    </tr>
</table>
<!--------------- 여기까지 view2-------------------------------------//------->


요 부분도 중요함 스크립트 붙여 넣기 함
<script>
function ch_img(id){
  var ol = document.getElementById("orgin_img");
  ol.src = document.getElementById(id).src;
}


동일한 창에서 갤러리뷰를 2개이상 구동시 view1에 있는 갤러리만 구현이되고 view2갤러리는 구동이 안되네요~ 스크립트에 변수를 넣어주어야 하는지 조언부탁드립니다.

댓글 전체

1. 최근게시물 스킨 복사하여 스킨명을 다르게 저장하시고... 시도

2. ch_img 명을 변경해 보시지요.. ch_img1 으로... 시도

3. 해도 안되면 id 명 fimg 도 ... 시도
안녕하세요^^

2개 충분히 구동이 됩니다...

간단하게 이해를 드리자면.. 갤러리 소스는 view1 view2 2개를 만드시고 스크립트는 1개를 만드 셨으니.. 안되는겁니다.~~

디자이너 분이신거 같은데 어렵게 설명드리는거 보다 쉽게 설명 드리겠습니다.

function ch_img(id){
  var ol = document.getElementById("orgin_img");
  ol.src = document.getElementById(id).src;
}


자 스크립트를 보시면 orgin_img 이녀석을 이미지를 계속 바꾸는 겁니다.

그런데 view1 이나 view2 나 이름이 같습니다.

이럴때는

view2 에 있는걸 id 명을 orgin_img2 만들고

function ch_img2(id){
  var ol = document.getElementById("orgin_img2");
  ol.src = document.getElementById(id).src;
}

스크립트도 이렇게 하나 더 만듭니다.

그리고 마지막으로 view2에 함수불러오는 부분에 마지막 20번을 예를 들께요

ch_img2('fimg20'); 이렇게 불러 오시면 orgin_img2 에 있는 갤러리도 될겁니다.

도움이 되셨으면 합니다.
전체 66,554 |RSS
그누4 질문답변 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT