Monday, August 16, 2010

How to open a local document with a HTML button & Javascript?

I am trying to create a button (or if I have to a hyperlink) that opens a local file. I am having trouble doing this.





I created a function


function openfile()


{


window.location(';C:/Documents and Settings/USERNAME/My Documents/Personal/somePDF.pdf';);


}





Then create a button





%26lt;input type=';button'; value=';somepdf.pdf'; name=';button1'; onClick=';openfile()'; /%26gt;





But this doesn't work. How do I do this? What am I doing wrong?How to open a local document with a HTML button %26amp; Javascript?
Use: window.location=';file://C:/Documents and Settings/USERNAME/My Documents/Personal/somePDF.pdf';;





instead

No comments:

Post a Comment