채택완료

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

2015-11-17 (화) 14:22:00 4,681
Copy
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 />" );}
Copy
<a href="javascript:showLayer('Layer1', <?php echo $bo_table ?>, <?php echo $img_file ?>, <?php echo $row['wr_id'] ?>);">
 

답변 4개

채택된 답변
+20 포인트
2015-11-17 (화) 15:32:35
Copy
<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(문자열)의 경우는 전부 따옴표로 감싸야 합니다. 

2015-11-17 (화) 15:14:43

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

Copy
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'&nbsp; 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 위치 변경
2015-11-17 (화) 14:51:43

안먹네요;;; 

2015-11-17 (화) 14:42:23
Copy
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'&nbsp; 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 />");}

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

답변을 작성하려면 로그인이 필요합니다.