이게 호출이 안되네요.. 문제점이 뭔가요?

이게 호출이 안되네요.. 문제점이 뭔가요?

QA

이게 호출이 안되네요.. 문제점이 뭔가요?

본문


function showLayer(ObShow, bo_table, fn, wr_id) {
   document.getElementById(ObShow).style.visibility="visible";
 document.write(" <div id='Layer1'> ");
 document.write(" <a href=\"javascript:hideLayer('Layer1');\" name='ly1'  value='hide 1'>close</a> ");
 document.write(" <br /> ");
 document.write(" </div> ");  
 var img_url = "../data/file/'+bo_table+'/'+wr_id+'/'+fn+";
 document.write ( "<img src="+img_url+" width=600 />" );
}

 


<a href="javascript:showLayer('Layer1', <?php echo $bo_table ?>, <?php echo $img_file ?>, <?php echo $row['wr_id'] ?>);">
 

이 질문에 댓글 쓰기 :

답변 4


<script type="text/javascript">
function showLayer(ObShow, bo_table, fn, wr_id) {
   var img_url = "../data/file/" + bo_table + "/" + wr_id + "/" + fn;
   document.getElementById(ObShow).style.visibility = "visible";
   document.write(" <div id='Layer1'> ");
   document.write(" <a href=\"javascript:hideLayer('Layer1');\" name='ly1' value='hide 1'>close</a> ");
   document.write(" <br /> ");
   document.write(" </div> ");
   document.write ( "<img src=" + img_url + " width='600' />" );
}
</script>
<a href="javascript:showLayer('Layer1', '<?php echo $bo_table ?>', '<?php echo $img_file ?>', '<?php echo $row['wr_id'] ?>');">

string(문자열)의 경우는 전부 따옴표로 감싸야 합니다. 


function showLayer(ObShow, bo_table, fn, wr_id) {
document.getElementById(ObShow).style.visibility="visible";
document.write("<div id='Layer1'> ");
document.write("<a href=\"javascript:hideLayer('Layer1');\" name='ly1'  value='hide 1'>close</a>");
document.write("<br />");
document.write("</div>"); 
//var img_url = "../data/file/'+bo_table+'/'+wr_id+'/'+fn+"; 
var img_url = "../data/file/"+bo_table+"/"+wr_id+"/"+fn;
document.write( "<img src="+img_url+" width=600 />");
}

 

이렇게 되어야 하는거 아닌가요 ?

해결 방법 찾았습니다...


function hideLayer(ObHide) {
document.getElementById(ObHide).style.visibility="hidden";
}
function showLayer(bo_table, fn, wr_id) {
document.write("<div id='Layer1'> ");
document.write("<a href=\"javascript:hideLayer('Layer1');\" name='ly1'  value='hide 1'>close</a>");
document.write("<br />");
var img_url = "../data/file/"+bo_table+"/"+wr_id+"/"+fn;
document.write( "<img src="+img_url+" width=600 />");
document.write("</div>");
}
ObShow 삭제
document.getElementById(ObShow).style.visibility="visible"; 삭제
ver img_url 랑 바로 밑에있던 write 위치 변경
답변을 작성하시기 전에 로그인 해주세요.
전체 27
QA 내용 검색

회원로그인

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