HTML Help Forum Index HTML Help
Please Search for the answer to your question before asking it! Thanks.
 

Javascript button
Post a Reply to this Topic Ask a New Question
Click here to go to the original topic
       HTML Help Forum Index -> Javascript
View previous topic :: View next topic  
Author Message
alex_85



Joined: 05 Jun 2009
Posts: 10

Posted: Mon Jul 27, 2009 6:43 pm     Javascript button  

HTML/Javascript. Ive created a download button for an image. I need the button to download a separate image. I have the code all done just need a few tweeks i hope. I already paid someone to get me this far but he is unavailable and i need this now. By tomorrow at the latest.

here's the code that loads the image on click into an iframe. just need the download button do download a 3rd image that isn't on the page...


<script>
var imgID1;
function saveImageAs()
{

var browser = navigator.appName;
//alert("browser is "+ browser);

if (browser=="Microsoft Internet Explorer")
{
//window.win = open(imgID1,'msg','scrollbar=no,menubar=no,width=1,height=1,resizable=no,toolbar=no');

//window.win.document.execCommand("SaveAs");
//alert(document.getElementById('img1').contentWindow)
document.getElementById('img').contentWindow.document.execCommand('saveas', true ,imgID1);
//window.win.moveTo(180,130);
//window.win.close();
}
else
{


}
}

function enlargeImage(id,strImage)
{
//alert("testing...");
var imgId = document.getElementById("showImg");
imgId.innerHTML ="<iframe id=img src="+strImage+" width= 600 height=400 scrolling=no frameborder=0px></iframe>";
imgID1 = strImage;

document.getElementById("btndownload").style.visibility = "visible";
}

</script>

<body oncontextmenu="return false">

<div class="gallery">
<img src="a3.jpg" onClick="enlargeImage(this.id,'a3.jpg')" id="img1" width="100" height="100"/>
<img src="b3.jpg" onClick="enlargeImage(this.id,'b3.jpg')" id="img1" width="100" height="100"/>
</div>
<div id="showImg" align="center">

</div>
<div align="center">
<input type="button" value="download" name="btn" id="btndownload" style="visibility:hidden" onClick="saveImageAs()">
</div>

</body>
 
 
DARFUR
HOSTING / DESIGN
MAKE MONEY

       HTML Help Forum Index -> Javascript
Page 1 of 1


Powered by phpBB Search Engine Indexer
Powered by phpBB 2.0.19 © 2001, 2002 phpBB Group