Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

file downloading

Status
Not open for further replies.

usnewc

Technical User
Joined
Mar 6, 2002
Messages
1
Location
US
I want to allow web page visitors to download a file by simply clicking on a link, icon, name, whatever. How can I accomplish this, or better, where can I find out how to do it? These files are .pdf, .doc etc.
 
There are two ways:



1) In html:

<a href=&quot;mydoc.pdf&quot;>download</a>

or, if you prefer an image:
<a href=&quot;mydoc.pdf&quot;><img border=0 src=&quot;mypic.gif&quot;></a>




2) With Javascript:

<SCRIPT language=&quot;Javascript&quot;>
function mydownload()
{
document.location.href=&quot;mydoc.pdf&quot;;
}
</SCRIPT>

<a href=&quot;Javascript:mydownload()&quot;>download</a>

or, if you prefer an image:
<a href=&quot;Javascript:mydownload()&quot;><img border=0 src=&quot;mypic.gif&quot;></a>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top