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

right click event

Status
Not open for further replies.

taixut

Programmer
Oct 27, 2003
39
ES
Hi,

I have a web page with this piece of code so when i click on the icon it opens the document in a new window:

<SCRIPT language="JavaScript">
function C{
var open_doc = window.open('file:\\\\server\file.pdf','popup','scrollbars=yes,height=600,width=800,resizable=yes');
}
</SCRIPT>
<a href="javascript:eek:pen_doc895312493()" ><img border="0" src="/acrobat.gif" widht="18" height="18" alt ="\\server\file.pdf" align="middle"></a>


Now i've been asked if it's possible to right click on the icon to save the file. Right now, if you try to do so you get an error as it tries to open "open_doc895312493()"


Thanks.
 
Yes it is possible, but we'd need to see the "open_docdoc895312493" function to know what to make the hyperlink. The function you've given us is called "C", and is never being called.

Dan


[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Sorry...
Some problem copy-pasting...

<SCRIPT language="JavaScript">
function open_doc895312493() {
var open_doc = window.open('file:\\\\server\file.pdf','popup','scrollbars=yes,height=600,width=800,resizable=yes');
}
</SCRIPT>
<a href="javascript:eek:pen_doc895312493()" ><img border="0" src="/acrobat.gif" widht="18" height="18" alt ="\\server\file.pdf" align="middle"></a>


 
By "right click on the icon to save the file" do you refer to the underlying image (acrobat.gif) or to the pdf file (file.pdf) that is opened in the new window?

I would guess you mean the latter. In which case...
Code:
<a href="file://server/file.pdf" onclick="window.open('file://server/file.pdf','popup','scrollbars=yes,height=600,width=800,resizable=yes');return false;"><img border="0" src="/acrobat.gif" width="18" height="18" alt ="\\\\server\file.pdf" align="middle"></a>
You may have to fiddle somewhat to get your file paths working, but this works when right-clicking and chooseing "Save link as" (in FF windows).

Cheers,
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top