첨부파일 목록에서 바로보기 채택완료
주봉이
8년 전
조회 4,003
안녕하세요
질문하려구요
목록에서 첨부파일을 다운로드가 아닌 바로보기 하고 싶은데요
<?php if($list[$i]['file'][0]['file']){ ?><a href="/enbs/data/file/data/<?=$list[$i]['file'][0]['file']?>">설명서</a><?php }?>
이렇게 했더니 클릭하면 파일 다운로드 할건지 열건지 물어보는 창이 나오는데요
이것이 아니고 클릭하면 바로 열리게 하려면 어찌해야 할까요?
댓글을 작성하려면 로그인이 필요합니다.
답변 1개
8년 전
링크 이미지를 바로 HTML 뷰어로 띄워주면됩니다.
아래 소스는 이미지 링크를 입력하면 HTML 파일없이 새창으로 이미지를 띄워주는 스크립트입니다.
응용해보세요.
</p><p><html></p><p><head>
<meta http-equiv="content-type" content="text/html; charset=euc-kr">
<title>제목 없음</title>
<meta name="author" content="태그인넷 <a href="<a href="http://www.tagin.net" target="_blank" rel="noopener noreferrer">http://www.tagin.net</a>">www.tagin.net</a>">
<script type="text/javascript"></p><p>var popbackground="ivory" //배경색상
var windowtitle="태그인넷" //타이틀 명</p><p>function detectexist(obj){
return (typeof obj !="undefined")
}</p><p>function jkpopimage(imgpath, popwidth, popheight, textdescription){</p><p>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</p><p>toppos-=screenTop
}
}</p><p>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">
'+textdescription+'</body></html>')
jkpopwin.document.close()
jkpopwin.focus()
}</p><p></script></p><p>
</head></p><p><body bgcolor="white" text="black" link="blue" vlink="purple" alink="red">
<a onClick="jkpopimage('<a href="<a href="http://tagin.net/img/logo.gif" target="_blank" rel="noopener noreferrer">http://tagin.net/img/logo.gif</a>"><a href="http://tagin.net/img/logo.gif" target="_blank" rel="noopener noreferrer">http://tagin.net/img/logo.gif</a></a>', 246, 200, '태그인넷 로고입니다.'); return false" style=cursor:hand> 태그인넷 열기</a>
</body></p><p></html></p><p>
출처는 예전에 인터넷으로 검색한거라 잘 모르겠습니다.
로그인 후 평가할 수 있습니다
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인