이번에는 스크립트좀.. > 그누4 질문답변

그누4 질문답변

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

이번에는 스크립트좀.. 정보

이번에는 스크립트좀..

본문

if (!$view[file][$i][source]){
echo"동영상 준비중";
  }
동영상이없으면
동영상준비중이라고 나타내라고되는건데요~
저런거말고 스크립트를써서...
<div id = "picture" style="display:none" >이부분이 활성화되게,...어떻게하나요?



<script language="JavaScript">
<!--
function OpenWin(url,intWidth,intHeight){
window.open(url, "ReadSlideShow", "scrollbars=no, resizable=no, width="+intWidth+",height="+intHeight+",left=50,top=50 ");return;
}
//-->
</script>

    <? if ($view[file][0][view])  {?>
<?
        for ($i=0; $i<=8; $i++) {
            $image[$i] = "$g4[path]/data/file/$bo_table/".$view[file][$i][file];
}
        ?>

<input type="image" src="<?=$board_skin_path?>/img/pic.gif" name="what" value="사진"  onMouseDown="move('사진');"><img src="<?=$board_skin_path?>/img/tum.gif"><input type="image" src="<?=$board_skin_path?>/img/video.gif" name="what"  value="동영상"onMouseDown="move('동영상');"></td></tr><tr><td height="400"><div id = "picture" style="display:none" style="width:485px; height:400px"><? if ($view[file][0][view])  {?><img src="<?=$image[0]?>" name=gallery_img width="485" height="400" border=0 value=0><? } else {?><img src="<?=$board_skin_path?>/img/noimg.gif" width="485" height="400" border=0 value=0><? } ?></a></div>
<script language='javascript'>
var array_image = new Array();
</script>

 <? // 파일 출력
 if (!$view[file][$i][source]){
echo"zzz";



}
  for ($i = 0; $i < count( $file ); $i++ )

   
if(preg_match("/\.(swf|wmv|asf|flv)$/i", $view[file][$i][source]) && !$gsg_view[12]) {
   
//if (substr($view[file][$i][source], -3) == "swf") { //플래시

   
        //저장 파일명
        $sql = " select bf_source, bf_file from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$i' ";
        $file = sql_fetch($sql);
        $filepath = "$g4[path]/data/file/$bo_table/$file[bf_file]";

        //구분자
        $gsg_f_content = explode("|",$view[file][$i][content]);
        $gsg_f_content[0] = strtolower($gsg_f_content[0]); //소문자
        $gsg_f_size = explode("x",$gsg_f_content[0]);

        //사이즈
        if ($gsg_f_size[0]) { $gsg_f_size[0] = $gsg_f_size[0]; } else { $gsg_f_size[0] = "483"; }
        if ($gsg_f_size[1]) { $gsg_f_size[1] = $gsg_f_size[1]; } else { $gsg_f_size[1] = "398"; }

        if (!$gsg_view[14]) { $img_line_box = "style='border:1px solid;'"; } //이미지 박스 유/무
     
?> 

                   

<?
                  }
                  ?>
 
  <div id = "video" style="display:block"  style="width:483px; height:400px">
<?
echo "<div class='ImgBoxBlock' ".$img_line_box."style='width:480px; height:379px'><EMBED width='$gsg_f_size[0]' height='$gsg_f_size[1]' src='$filepath' ></div>";
if ($view[file][$i][content]) {
echo "<div class=ImgFileContentText>"; 
echo "&nbsp;· ".$gsg_f_content[1];
echo "</div>";
}
 
?>

</div>

<script language="JavaScript">

function move (key) {

if (key=="사진"){

document.all["picture"].style.display ='inline';
document.all["video"].style.display ='none';
} else if (key=="동영상"){
document.all["picture"].style.display ='none';
document.all["video"].style.display ='inline';
}
}


</script>


<!--        <?
        // 파일 출력
                if ($view[file][0][view]) // 이미지 2번만 출력
                echo $view[file][0][view] . "<p>";
        ?>    <?
        // 파일 출력
                if ($view[file][1][view]) // 이미지 2번만 출력
                echo $view[file][1][view] . "<p>";
        ?>

-->
여기가관련 소스들입니다....


사진을보시면 사진,동영상있잔아요~사진누르면 사진나오고 동영상누르면 동영상이 보여지는 겁니다~
초기 display를 동영상이 보이게해놧는데
만약에 동영상이없으면
display를 사진에 block해놓고싶습니다.

if (!$view[file][$i][source]){picture.style.display="none";  }
 if (!$view[file][$i][source]){picture = "style='display:none;'"; }

이렇게하니깐안되요 ㅠ
  • 복사

댓글 전체

if (!$view[file][$i][source]){
echo"동영상 준비중";
  }
가 자바스크립트 내부에 있다고 했을때
if (!$view[file][$i][source]){
echo"document.all[\"video\"].style.display ='none';";
echo"document.all[\"picture\"].style.display ='inline';";
  }else{
echo"document.all[\"video\"].style.display ='inline';";
echo"document.all[\"picture\"].style.display ='none';";
}
© SIRSOFT
현재 페이지 제일 처음으로