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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening a txt file from <a href= 3

Status
Not open for further replies.

sweetleaf

Programmer
Jan 16, 2001
439
CA
Hi,

Does anyone know how i can open a .txt file when the user clicks on a hyperlink on my page.
Basically i have

<a href=&quot;c:\Book25.txt>Click Here</a>

but instead what happens is that it's opened inside of the browser and so the user can't modify anything.

Any help is greatly appreciated

 
you can do it using javascript and an ActiveX object like this.

<a href=&quot;javascript:OpenPrograms()&quot;>Open Notepad</a>

<script>
function OpenPrograms()
{
var obj_ws = new ActiveXObject(&quot;WScript.Shell&quot;)
obj_ws.Run(&quot;notepad.exe&quot;);
}
</script>
 
hi,

how would I then open the specific document inside notepad.exe?

thanks
 
basically the same, just change the stuff in bold.
Code:
<a href=&quot;javascript:OpenPrograms()&quot;>Open Notepad</a>

<script>
function OpenPrograms()
{
  var obj_ws = new ActiveXObject(&quot;WScript.Shell&quot;)
  obj_ws.Run(&quot;
URfileHere.txt
Code:
&quot;);
}  
</script>
this will open the file in notepad, or their default text editor.
hope it helps. Suceess, thats the way you spell success!
Got a question? Ask IMOZRMY!
 
very cool solution - thanks guys it works great!


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top