|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
||||
|
||||
|
hey all!
i am making an image gallery where people can pick the details of the image that they want and then click a button and based on the values that are entered they will download a certain image so i have this form... 6 radio buttons and a submit. O - 72 dpi O - 150 dpi O - 300 dpi O - color O - black O - white (Submit) so then the idea would be if they select 150 dpi - black then they would download that proper file, say image1_150_blk.jpg for example i dont think it is too hard but yea i dont really know a whole lot of javascript so i could be wrong...but its a fun little project and i would sooo appreciate it if anyone has a script for this, or if you know what you would call this so i could search for it!! i would greatly appreciate ANY advice!!! thank you thank you thank you in advance!!! ROCK ON!! (yes i posted this to the javascript forum but people in there are mean and despite the 22 views no one was kind enough to even reply! thanks!!!! )
__________________
"I hate quotations." -ralph waldo emerson- |
|
#2
|
||||
|
||||
|
Must have missed it in the other forum, but something similar to this should work:
Code:
<script>
function do_image()
{
if(document.forms.myform.d72.checked) { var res = 72; }
if(document.forms.myform.d150.checked) { var res = 150; }
if(document.forms.myform.d300.checked) { var res = 300; }
if(document.forms.myform.c1.checked) { var color = "clr"; }
if(document.forms.myform.c2.checked) { var color = "blk"; }
if(document.forms.myform.c3.checked) { var color = "wht"; }
var image_url = "myimage_" + res + "_" + color + ".jpg";
window.location.href = image_url;
}
</script>
<!-- Then the form: !-->
<form action="#" method="get" name="myform">
<input type="radio" name="dpi" id="d72" value="72" checked> - 72 dpi<br>
<input type="radio" name="dpi" id="d150" value="150"> - 150 dpi<br>
<input type="radio" name="dpi" id="d300" value="300"> - 300 dpi<br>
<br>
<br>
<input type="radio" name="color" id="c1" value="clr" checked> - Color<br>
<input type="radio" name="color" id="c2" value="blk"> - Black<br>
<input type="radio" name="color" id="c3" value="wht"> - White<br>
<input type="submit" value="download" onclick="do_image(); return false;">
</form>
HTH
__________________
Obstruct the doors, cause delays, be dangerous. |
![]() |
| Viewing: Dev Shed Forums > Web Site Management > Scripts > Download File Script based on form options |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|