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

document.execCommand...

Status
Not open for further replies.

frenchtaquito

Technical User
Apr 5, 2001
56
US
Doesn anyone know what the command is( or if there is one) to assign to a button that would do the same thing as right clicking & using the save picture as command?
Example - document.execCommand("SaveAs") but "save picture as" instead.

Any help would be greatly appreciated. Cheers
 
hey, we've discussin this subject, lemme help u..

here u are:
quote:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IE supports
document.execCommand('SaveAs')
to save the current page. It looks as if you can also open a page with
an image in it and then call the command on the image page:

function saveImageAs (imgOrURL) {
if (typeof imgOrURL == 'object')
imgOrURL = imgOrURL.src;
window.win = open (imgOrURL);
setTimeout('win.document.execCommand("SaveAs")', 500);
}
<A HREF=&quot;javascript: void (0)&quot;
ONCLICK=&quot;saveImageAs(document.images.anImage); return false&quot;
>save image</A>
<IMG NAME=&quot;anImage&quot; SRC=&quot;whatever.gif&quot;>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

sorry, i have no nick assigned 2 this answer in my library :-(
regards, vic
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top