첨부파일 목록에서 바로보기

첨부파일 목록에서 바로보기

QA

첨부파일 목록에서 바로보기

본문

안녕하세요

질문하려구요

목록에서 첨부파일을 다운로드가 아닌 바로보기 하고 싶은데요

<?php if($list[$i]['file'][0]['file']){ ?><a href="/enbs/data/file/data/<?=$list[$i]['file'][0]['file']?>">설명서</a><?php }?>

이렇게 했더니 클릭하면 파일 다운로드 할건지 열건지 물어보는 창이 나오는데요

이것이 아니고 클릭하면 바로 열리게 하려면 어찌해야 할까요? 

이 질문에 댓글 쓰기 :

답변 1

링크 이미지를 바로 HTML 뷰어로 띄워주면됩니다.

아래 소스는 이미지 링크를 입력하면 HTML 파일없이 새창으로 이미지를 띄워주는 스크립트입니다.

응용해보세요.

 


<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=euc-kr">
<title>제목 없음</title>
<meta name="author" content="태그인넷 www.tagin.net">
<script type="text/javascript">
var popbackground="ivory" //배경색상
var windowtitle="태그인넷" //타이틀 명
function detectexist(obj){
return (typeof obj !="undefined")
}
function jkpopimage(imgpath, popwidth, popheight, textdescription){
function getpos(){
leftpos=(detectexist(window.screenLeft))? screenLeft+document.body.clientWidth/2-popwidth/2 : detectexist(window.screenX)? screenX+innerWidth/2-popwidth/2 : 0
toppos=(detectexist(window.screenTop))? screenTop+document.body.clientHeight/2-popheight/2 : detectexist(window.screenY)? screenY+innerHeight/2-popheight/2 : 0
if (window.opera){
leftpos-=screenLeft
toppos-=screenTop
}
}
getpos()
var winattributes='width='+popwidth+',height='+popheight+',resizable=yes,left='+leftpos+',top='+toppos
var bodyattribute=(popbackground.indexOf(".")!=-1)? 'background="'+popbackground+'"' : 'bgcolor="'+popbackground+'"'
if (typeof jkpopwin=="undefined" || jkpopwin.closed)
jkpopwin=window.open("","",winattributes)
else{
//getpos() //uncomment these 2 lines if you wish subsequent popups to be centered too
//jkpopwin.moveTo(leftpos, toppos)
jkpopwin.resizeTo(popwidth, popheight+30)
}
jkpopwin.document.open()
jkpopwin.document.write('<html><title>'+windowtitle+'</title><body '+bodyattribute+'><img src="'+imgpath+'" style="margin-bottom: 0.5em"><br>'+textdescription+'</body></html>')
jkpopwin.document.close()
jkpopwin.focus()
}
</script>

</head>
<body bgcolor="white" text="black" link="blue" vlink="purple" alink="red">
<a onClick="jkpopimage('http://tagin.net/img/logo.gif', 246, 200, '태그인넷 로고입니다.'); return false" style=cursor:hand> 태그인넷 열기</a> 
</body>
</html>

 

출처는 예전에 인터넷으로 검색한거라 잘 모르겠습니다.

 

 

 

답변을 작성하시기 전에 로그인 해주세요.
전체 123,531 | RSS
QA 내용 검색

회원로그인

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