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

Mmm.. odd error with document.costform.CanvasType.value 1

Status
Not open for further replies.

youradds

Programmer
Jun 27, 2001
817
GB
Hi,

Got a bit of a problem with the below code:

Code:
<script>

  function updateCosts() {
  
     var theCost;
  
     var paper_8x10 = '5';
     var paper_9x12 = '11';  
     var paper_11x14 = '15';
     var paper_12x16 = '19';
     var paper_14x18 = '26';
     var paper_16x20 = '33';
     var paper_18x24 = '45';
     var paper_20x24 = '49';
     var paper_24x30 = '75';
     var paper_24x36 = '90';
     var paper_36x36 = '135';
     var paper_36x40 = '150';
     var paper_40x40 = '165';
     var paper_48x48 = '240';
     var paper_60x60 = '375';
     
     var canvas_8x10 = '10';
     var canvas_9x12 = '15';  
     var canvas_11x14 = '20';
     var canvas_12x16 = '26';
     var canvas_14x18 = '35';
     var canvas_16x20 = '44';
     var canvas_18x24 = '60';
     var canvas_20x24 = '66';
     var canvas_24x30 = '100';
     var canvas_24x36 = '120';
     var canvas_36x36 = '180';
     var canvas_36x40 = '200';
     var canvas_40x40 = '220';
     var canvas_48x48 = '320';
     var canvas_60x60 = '500';     

     var canvasmuseum = '60';
     var canvasframefriendly = '40';
        
     if (document.costform.PaperSize.value == "8x10_paper") {
        theCost = paper_8x10;
     } else if (document.costform.PaperSize.value == "9x12_paper") {
        theCost = paper_9x12;       
     } else if (document.costform.PaperSize.value == "11x14_paper") {
        theCost = paper_11x14;
     } else if (document.costform.PaperSize.value == "12x16_paper") {
        theCost = paper_12x16;
     } else if (document.costform.PaperSize.value == "14x18_paper") {
        theCost = paper_14x18;
     } else if (document.costform.PaperSize.value == "16x20_paper") {
        theCost = paper_16x20;
     } else if (document.costform.PaperSize.value == "18x24_paper") {
        theCost = paper_18x24;        
     } else if (document.costform.PaperSize.value == "20x24_paper") {
        theCost = paper_20x24;
     } else if (document.costform.PaperSize.value == "24x30_paper") {
        theCost = paper_24x30;
     } else if (document.costform.PaperSize.value == "24x36_paper") {
        theCost = paper_24x36;
     } else if (document.costform.PaperSize.value == "36x36_paper") {
        theCost = paper_36x36;
     } else if (document.costform.PaperSize.value == "36x40_paper") {
        theCost = paper_36x40;
     } else if (document.costform.PaperSize.value == "40x40_paper") {
        theCost = paper_40x40;                                        
     } else if (document.costform.PaperSize.value == "48x48_paper") {
        theCost = paper_48x48;
     } else if (document.costform.PaperSize.value == "60x60_paper") {
        theCost = paper_60x60;   
     } else if (document.costform.PaperSize.value == "8x10_canvas") {
        theCost = canvas_8x10;    
     } else if (document.costform.PaperSize.value == "9x12_canvas") {
        theCost = canvas_9x12;       
     } else if (document.costform.PaperSize.value == "11x14_canvas") {
        theCost = canvas_11x14;
     } else if (document.costform.PaperSize.value == "12x16_canvas") {
        theCost = canvas_12x16;
     } else if (document.costform.PaperSize.value == "14x18_canvas") {
        theCost = canvas_14x18;
     } else if (document.costform.PaperSize.value == "16x20_canvas") {
        theCost = canvas_16x20;
     } else if (document.costform.PaperSize.value == "18x24_canvas") {
        theCost = canvas_18x24;        
     } else if (document.costform.PaperSize.value == "20x24_canvas") {
        theCost = canvas_20x24;
     } else if (document.costform.PaperSize.value == "24x30_canvas") {
        theCost = canvas_24x30;
     } else if (document.costform.PaperSize.value == "24x36_canvas") {
        theCost = canvas_24x36;
     } else if (document.costform.PaperSize.value == "36x36_canvas") {
        theCost = canvas_36x36;
     } else if (document.costform.PaperSize.value == "36x40_canvas") {
        theCost = canvas_36x40;
     } else if (document.costform.PaperSize.value == "40x40_canvas") {
        theCost = canvas_40x40;                                        
     } else if (document.costform.PaperSize.value == "48x48_canvas") {
        theCost = canvas_48x48;
     } else if (document.costform.PaperSize.value == "60x60_canvas") {
        theCost = canvas_60x60;   
     }

   alert(document.costform.CanvasType.value);

     var theCost2;
     if (document.costform.CanvasType.value == "framefriendly") {
        theCost2 = theCost + canvasframefriendly;
     } else if (document.costform.CanvasType.value == "museum") {
        theCost2 = theCost + canvasmuseum; 
     } else { theCost2 = theCost; }

//     var canvasMuseum = 60;
//     var canvasframefriendly = 40;    
 
 
     alert("cost is: " + theCost);  
     document.costform.TotalCost.value = theCost2;
  
  }
</script>

<form name="costform" method="POST" action="--WEBBOT-SELF--">
	<p><b>Print Size:</b>&nbsp; <select size="1" name="PaperSize" onchange="updateCosts();">

	<option value="">-- SELECT TYPE --</option>
    <optgroup label="Paper Canvas">Paper</optgroup>
	<option value="8x10_paper">&nbsp;&nbsp;8&quot; x 10&quot; - $5</option>
	<option value="9x12_paper">&nbsp;&nbsp;9&quot; x 12&quot; - $11</option>
	<option value="11x14_paper">&nbsp;&nbsp;11&quot; x 14&quot; - $15</option>
	<option value="12x16_paper">&nbsp;&nbsp;12&quot; x 16&quot; - $19</option>
	<option value="14x18_paper">&nbsp;&nbsp;14&quot; x 18&quot; - $26</option>
	<option value="16x20_paper">&nbsp;&nbsp;16&quot; x 20&quot; - $33</option>
	<option value="18x24_paper">&nbsp;&nbsp;18&quot; x 24&quot; - $45</option>
	<option value="20x24_paper">&nbsp;&nbsp;20&quot; x 24&quot; - $49</option>
	<option value="24x30_paper">&nbsp;&nbsp;24&quot; x 30&quot; - $75</option>
	<option value="24x36_paper">&nbsp;&nbsp;24&quot; x 36&quot; - $90</option>
	<option value="36x36_paper">&nbsp;&nbsp;36&quot; x 36&quot; - $135</option>	
	<option value="36x40_paper">&nbsp;&nbsp;36&quot; x 40&quot; - $150</option>
	<option value="40x40_paper">&nbsp;&nbsp;40&quot; x 40&quot; - $165</option>
	<option value="48x48_paper">&nbsp;&nbsp;48&quot; x 48&quot; - $240</option>
	<option value="60x60_paper">&nbsp;&nbsp;60&quot; x 60&quot; - $375</option>

    <optgroup label="Paper Canvas">Canvas</optgroup>
	<option value="8x10_canvas">&nbsp;&nbsp;8&quot; x 10&quot; - $10</option>
	<option value="9x12_canvas">&nbsp;&nbsp;9&quot; x 12&quot; - $15</option>
	<option value="11x14_canvas">&nbsp;&nbsp;11&quot; x 14&quot; (1)- $20</option>
	<option value="12x16_canvas">&nbsp;&nbsp;12&quot; x 16&quot; (1.3) - $26</option>
	<option value="14x18_canvas">&nbsp;&nbsp;14&quot; x 18&quot; (1.75)- $35</option>
	<option value="16x20_canvas">&nbsp;&nbsp;16&quot; x 20&quot; (2.2)- $44</option>
	<option value="18x24_canvas">&nbsp;&nbsp;18&quot; x 24&quot; (3)- $60</option>
	<option value="20x24_canvas">&nbsp;&nbsp;20&quot; x 24&quot; (3.3) - $66</option>
	<option value="24x30_canvas">&nbsp;&nbsp;24&quot; x 30&quot; (5) - $100</option>
	<option value="24x36_canvas">&nbsp;&nbsp;24&quot; x 36&quot; (6) - $120</option>
	<option value="36x36_canvas">&nbsp;&nbsp;36&quot; x 36&quot; (9) - $180</option>	
	<option value="36x40_canvas">&nbsp;&nbsp;36&quot; x 40&quot; (10) - $200</option>
	<option value="40x40_canvas">&nbsp;&nbsp;40&quot; x 40&quot; (11) - $220</option>
	<option value="48x48_canvas">&nbsp;&nbsp;48&quot; x 48&quot; (16) - $320</option>
	<option value="60x60_canvas">&nbsp;&nbsp;60&quot; x 60&quot; (25) - $500 </option>

		
	</select></p>
	<table border="1" width="100%">
		<tr>
			<td><b>
			<input type="radio" value="printonly" name="CanvasType" id="CanvasType" checked="yes" onclick="updateCosts();">Print 
			Only</b> </td>
			<td>No additional charge</td>
		</tr>
		<tr>
			<td><b><input type="radio" value="museum" name="CanvasType" onclick="updateCosts();">Museum 
			wrapped canvas 1.5&quot; thick</b></td>
			<td>$60 additional </td>
		</tr>
		<tr>
			<td><b><input type="radio" name="CanvasType" value="framefriendly" onclick="updateCosts();">Frame-Friendly 
			wrapped canvas</b></td>
			<td>$40 additional </td>
		</tr>
	</table>
	<p><input type="text" name="TotalCost" size="20" readonly="yes"></p>
	<p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>

The first bit works fine (Print Size)

.. but for some reason, the document.costform.CanvasType.value bit is giving "undefined" as the value - is this just a stupid error on my front (i.e if Javascript expecting something different to the document.costform.CanvasType.value format?)

I've had a look around - but couldn't work it out :(

TIA

Andy
 
to get the value of a <select> field you need to call it like this
Code:
document.costform.CanvasType.options[document.costform.CanvasType.selectedIndex].value


``The wise man doesn't give the right answers,
he poses the right questions.''
TIMTOWTDI
 
my appologies...change CanvasType with [red]PaperSize[/red]
Code:
document.costform.[red]PaperSize[/red].options[document.costform.[red]PaperSize[/red].selectedIndex].value


``The wise man doesn't give the right answers,
he poses the right questions.''
TIMTOWTDI
 
or simply this:
[tt] document.costform.PaperSize.value[/tt]
 
Hi,

Thanks for the reply - that gives me an error in IE and FF though :/

Error: document.costform.CanvasType.selectedIndex has no properties
Source File: file:///C:/Users/Ace/Documents/My%20Web%20Sites/cart_print_rob.htm
Line: 104

any ideas?

TIA

Andy
 
Hi perluserpengo,

Mmm.. I think your mis-understanding me =)

It *is* document.costform.CanvasType that I need to look for the value of (basically, if it == "museum", set the price as 60, or is "framefriendly" , then use 40

...the code you gave first looks like it would do what I need - appart from it giving me an error <G>

TIA!

Andy
 
BTW, its this bit thats causing the problem

Code:
   alert(document.costform.CanvasType.value);

     var theCost2;
     if (document.costform.CanvasType.value == "framefriendly") {
        theCost2 = theCost + canvasframefriendly;
     } else if (document.costform.CanvasType.value == "museum") {
        theCost2 = theCost + canvasmuseum;
     } else { theCost2 = theCost; }

Thanks :)
 
sorry mate...my appologies again...I think i need some sleep.

change this
Code:
alert(document.costform.CanvasType.value);
var theCost2;
if (document.costform.CanvasType.value == "framefriendly") {
        theCost2 = theCost + canvasframefriendly;
     } else if (document.costform.CanvasType.value == "museum") {
        theCost2 = theCost + canvasmuseum;
     } else { theCost2 = theCost; }

with this
Code:
	var radioLength = document.costform.CanvasType.length;
	for(var i = 0; i < radioLength; i++) {
		if ( document.costform.CanvasType[i].checked ==true ){
            alert(document.costform.CanvasType[i].value);
			if (document.costform.CanvasType[i].value == "framefriendly") {
				theCost2 = theCost + canvasframefriendly;
			} else if (document.costform.CanvasType[i].value == "museum") {
				theCost2 = theCost + canvasmuseum;
			} else { theCost2 = theCost; }
		}
	}


``The wise man doesn't give the right answers,
he poses the right questions.''
TIMTOWTDI
 
Hi,

Thanks - I'm with you on the sleep thing ;)

Still not joy though .. I get this error:

Error: document.costform.CanvasType.selectedIndex has no properties
Source File: file:///C:/Users/Ace/Documents/My%20Web%20Sites/cart_print_rob.htm
Line: 104

:'(

TIA!

Andy
 
I also though suggest to use
Code:
document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value
to get the value of a select box cause some browsers dont like the simple
Code:
document.costform.PaperSize.value

and always loop the elements of a radio button as above...good night guys


``The wise man doesn't give the right answers,
he poses the right questions.''
TIMTOWTDI
 
dude i post the wrong one the first time...i've corrected the right field name with red letters on the second



``The wise man doesn't give the right answers,
he poses the right questions.''
TIMTOWTDI
 
Code:
<script>

  function updateCosts() {
  
     var theCost;
  
     var paper_8x10 = '5';
     var paper_9x12 = '11';  
     var paper_11x14 = '15';
     var paper_12x16 = '19';
     var paper_14x18 = '26';
     var paper_16x20 = '33';
     var paper_18x24 = '45';
     var paper_20x24 = '49';
     var paper_24x30 = '75';
     var paper_24x36 = '90';
     var paper_36x36 = '135';
     var paper_36x40 = '150';
     var paper_40x40 = '165';
     var paper_48x48 = '240';
     var paper_60x60 = '375';
     
     var canvas_8x10 = '10';
     var canvas_9x12 = '15';  
     var canvas_11x14 = '20';
     var canvas_12x16 = '26';
     var canvas_14x18 = '35';
     var canvas_16x20 = '44';
     var canvas_18x24 = '60';
     var canvas_20x24 = '66';
     var canvas_24x30 = '100';
     var canvas_24x36 = '120';
     var canvas_36x36 = '180';
     var canvas_36x40 = '200';
     var canvas_40x40 = '220';
     var canvas_48x48 = '320';
     var canvas_60x60 = '500';     

     var canvasmuseum = '60';
     var canvasframefriendly = '40';
        
     if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "8x10_paper") {
        theCost = paper_8x10;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "9x12_paper") {
        theCost = paper_9x12;       
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "11x14_paper") {
        theCost = paper_11x14;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "12x16_paper") {
        theCost = paper_12x16;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "14x18_paper") {
        theCost = paper_14x18;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "16x20_paper") {
        theCost = paper_16x20;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "18x24_paper") {
        theCost = paper_18x24;        
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "20x24_paper") {
        theCost = paper_20x24;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "24x30_paper") {
        theCost = paper_24x30;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "24x36_paper") {
        theCost = paper_24x36;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "36x36_paper") {
        theCost = paper_36x36;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "36x40_paper") {
        theCost = paper_36x40;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "40x40_paper") {
        theCost = paper_40x40;                                        
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "48x48_paper") {
        theCost = paper_48x48;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "60x60_paper") {
        theCost = paper_60x60;   
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "8x10_canvas") {
        theCost = canvas_8x10;    
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "9x12_canvas") {
        theCost = canvas_9x12;       
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "11x14_canvas") {
        theCost = canvas_11x14;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "12x16_canvas") {
        theCost = canvas_12x16;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "14x18_canvas") {
        theCost = canvas_14x18;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "16x20_canvas") {
        theCost = canvas_16x20;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "18x24_canvas") {
        theCost = canvas_18x24;        
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "20x24_canvas") {
        theCost = canvas_20x24;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "24x30_canvas") {
        theCost = canvas_24x30;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "24x36_canvas") {
        theCost = canvas_24x36;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "36x36_canvas") {
        theCost = canvas_36x36;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "36x40_canvas") {
        theCost = canvas_36x40;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "40x40_canvas") {
        theCost = canvas_40x40;                                        
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "48x48_canvas") {
        theCost = canvas_48x48;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "60x60_canvas") {
        theCost = canvas_60x60;   
     }

//   alert(document.costform.CanvasType.value);

    var theCost2;

	var radioLength = document.costform.CanvasType.length;
	for(var i = 0; i < radioLength; i++) {
		if ( document.costform.CanvasType[i].checked ==true ){
			alert(document.costform.CanvasType[i].value);
			if (document.costform.CanvasType[i].value == "framefriendly") {
				theCost2 = theCost + canvasframefriendly;
			} else if (document.costform.CanvasType[i].value == "museum") {
				theCost2 = theCost + canvasmuseum;
			} else { theCost2 = theCost; }
		}
	}

//     if (document.costform.CanvasType.value == "framefriendly") {
//        theCost2 = theCost + canvasframefriendly;
//     } else if (document.costform.CanvasType.value == "museum") {
//        theCost2 = theCost + canvasmuseum;
//     } else { theCost2 = theCost; }

//     var canvasMuseum = 60;
//     var canvasframefriendly = 40;    
 
 
     alert("cost is: " + theCost);  
     document.costform.TotalCost.value = theCost2;
  
  }
</script>

<form name="costform" method="POST" action="--WEBBOT-SELF--">
    <p><b>Print Size:</b>&nbsp; <select size="1" name="PaperSize" onchange="updateCosts();">

    <option value="">-- SELECT TYPE --</option>
    <optgroup label="Paper Canvas">Paper</optgroup>
    <option value="8x10_paper">&nbsp;&nbsp;8&quot; x 10&quot; - $5</option>
    <option value="9x12_paper">&nbsp;&nbsp;9&quot; x 12&quot; - $11</option>
    <option value="11x14_paper">&nbsp;&nbsp;11&quot; x 14&quot; - $15</option>
    <option value="12x16_paper">&nbsp;&nbsp;12&quot; x 16&quot; - $19</option>
    <option value="14x18_paper">&nbsp;&nbsp;14&quot; x 18&quot; - $26</option>
    <option value="16x20_paper">&nbsp;&nbsp;16&quot; x 20&quot; - $33</option>
    <option value="18x24_paper">&nbsp;&nbsp;18&quot; x 24&quot; - $45</option>
    <option value="20x24_paper">&nbsp;&nbsp;20&quot; x 24&quot; - $49</option>
    <option value="24x30_paper">&nbsp;&nbsp;24&quot; x 30&quot; - $75</option>
    <option value="24x36_paper">&nbsp;&nbsp;24&quot; x 36&quot; - $90</option>
    <option value="36x36_paper">&nbsp;&nbsp;36&quot; x 36&quot; - $135</option>    
    <option value="36x40_paper">&nbsp;&nbsp;36&quot; x 40&quot; - $150</option>
    <option value="40x40_paper">&nbsp;&nbsp;40&quot; x 40&quot; - $165</option>
    <option value="48x48_paper">&nbsp;&nbsp;48&quot; x 48&quot; - $240</option>
    <option value="60x60_paper">&nbsp;&nbsp;60&quot; x 60&quot; - $375</option>

    <optgroup label="Paper Canvas">Canvas</optgroup>
    <option value="8x10_canvas">&nbsp;&nbsp;8&quot; x 10&quot; - $10</option>
    <option value="9x12_canvas">&nbsp;&nbsp;9&quot; x 12&quot; - $15</option>
    <option value="11x14_canvas">&nbsp;&nbsp;11&quot; x 14&quot; (1)- $20</option>
    <option value="12x16_canvas">&nbsp;&nbsp;12&quot; x 16&quot; (1.3) - $26</option>
    <option value="14x18_canvas">&nbsp;&nbsp;14&quot; x 18&quot; (1.75)- $35</option>
    <option value="16x20_canvas">&nbsp;&nbsp;16&quot; x 20&quot; (2.2)- $44</option>
    <option value="18x24_canvas">&nbsp;&nbsp;18&quot; x 24&quot; (3)- $60</option>
    <option value="20x24_canvas">&nbsp;&nbsp;20&quot; x 24&quot; (3.3) - $66</option>
    <option value="24x30_canvas">&nbsp;&nbsp;24&quot; x 30&quot; (5) - $100</option>
    <option value="24x36_canvas">&nbsp;&nbsp;24&quot; x 36&quot; (6) - $120</option>
    <option value="36x36_canvas">&nbsp;&nbsp;36&quot; x 36&quot; (9) - $180</option>    
    <option value="36x40_canvas">&nbsp;&nbsp;36&quot; x 40&quot; (10) - $200</option>
    <option value="40x40_canvas">&nbsp;&nbsp;40&quot; x 40&quot; (11) - $220</option>
    <option value="48x48_canvas">&nbsp;&nbsp;48&quot; x 48&quot; (16) - $320</option>
    <option value="60x60_canvas">&nbsp;&nbsp;60&quot; x 60&quot; (25) - $500 </option>

        
    </select></p>
    <table border="1" width="100%">
        <tr>
            <td><b>
            <input type="radio" value="printonly" name="CanvasType" id="CanvasType" checked="yes" onclick="updateCosts();">Print
            Only</b> </td>
         <script>

  function updateCosts() {
  
     var theCost;
  
     var paper_8x10 = '5';
     var paper_9x12 = '11';  
     var paper_11x14 = '15';
     var paper_12x16 = '19';
     var paper_14x18 = '26';
     var paper_16x20 = '33';
     var paper_18x24 = '45';
     var paper_20x24 = '49';
     var paper_24x30 = '75';
     var paper_24x36 = '90';
     var paper_36x36 = '135';
     var paper_36x40 = '150';
     var paper_40x40 = '165';
     var paper_48x48 = '240';
     var paper_60x60 = '375';
     
     var canvas_8x10 = '10';
     var canvas_9x12 = '15';  
     var canvas_11x14 = '20';
     var canvas_12x16 = '26';
     var canvas_14x18 = '35';
     var canvas_16x20 = '44';
     var canvas_18x24 = '60';
     var canvas_20x24 = '66';
     var canvas_24x30 = '100';
     var canvas_24x36 = '120';
     var canvas_36x36 = '180';
     var canvas_36x40 = '200';
     var canvas_40x40 = '220';
     var canvas_48x48 = '320';
     var canvas_60x60 = '500';     

     var canvasmuseum = '60';
     var canvasframefriendly = '40';
        
     if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "8x10_paper") {
        theCost = paper_8x10;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "9x12_paper") {
        theCost = paper_9x12;       
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "11x14_paper") {
        theCost = paper_11x14;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "12x16_paper") {
        theCost = paper_12x16;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "14x18_paper") {
        theCost = paper_14x18;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "16x20_paper") {
        theCost = paper_16x20;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "18x24_paper") {
        theCost = paper_18x24;        
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "20x24_paper") {
        theCost = paper_20x24;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "24x30_paper") {
        theCost = paper_24x30;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "24x36_paper") {
        theCost = paper_24x36;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "36x36_paper") {
        theCost = paper_36x36;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "36x40_paper") {
        theCost = paper_36x40;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "40x40_paper") {
        theCost = paper_40x40;                                        
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "48x48_paper") {
        theCost = paper_48x48;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "60x60_paper") {
        theCost = paper_60x60;   
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "8x10_canvas") {
        theCost = canvas_8x10;    
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "9x12_canvas") {
        theCost = canvas_9x12;       
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "11x14_canvas") {
        theCost = canvas_11x14;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "12x16_canvas") {
        theCost = canvas_12x16;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "14x18_canvas") {
        theCost = canvas_14x18;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "16x20_canvas") {
        theCost = canvas_16x20;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "18x24_canvas") {
        theCost = canvas_18x24;        
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "20x24_canvas") {
        theCost = canvas_20x24;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "24x30_canvas") {
        theCost = canvas_24x30;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "24x36_canvas") {
        theCost = canvas_24x36;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "36x36_canvas") {
        theCost = canvas_36x36;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "36x40_canvas") {
        theCost = canvas_36x40;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "40x40_canvas") {
        theCost = canvas_40x40;                                        
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "48x48_canvas") {
        theCost = canvas_48x48;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "60x60_canvas") {
        theCost = canvas_60x60;   
     }
    var theCost2;

	var radioLength = document.costform.CanvasType.length;
	for(var i = 0; i < radioLength; i++) {
		if ( document.costform.CanvasType[i].checked ==true ){
			alert(document.costform.CanvasType[i].value);
			if (document.costform.CanvasType[i].value == "framefriendly") {
				theCost2 = theCost + canvasframefriendly;
			} else if (document.costform.CanvasType[i].value == "museum") {
				theCost2 = theCost + canvasmuseum;
			} else { theCost2 = theCost; }
		}
	}
     alert("cost is: " + theCost);
     document.costform.TotalCost.value = theCost2;
  
  }
</script>

<form name="costform" method="POST" action="--WEBBOT-SELF--">
    <p><b>Print Size:</b>&nbsp; <select size="1" name="PaperSize" onchange="updateCosts();">

    <option value="">-- SELECT TYPE --</option>
    <optgroup label="Paper Canvas">Paper</optgroup>
    <option value="8x10_paper">&nbsp;&nbsp;8&quot; x 10&quot; - $5</option>
    <option value="9x12_paper">&nbsp;&nbsp;9&quot; x 12&quot; - $11</option>
    <option value="11x14_paper">&nbsp;&nbsp;11&quot; x 14&quot; - $15</option>
    <option value="12x16_paper">&nbsp;&nbsp;12&quot; x 16&quot; - $19</option>
    <option value="14x18_paper">&nbsp;&nbsp;14&quot; x 18&quot; - $26</option>
    <option value="16x20_paper">&nbsp;&nbsp;16&quot; x 20&quot; - $33</option>
    <option value="18x24_paper">&nbsp;&nbsp;18&quot; x 24&quot; - $45</option>
    <option value="20x24_paper">&nbsp;&nbsp;20&quot; x 24&quot; - $49</option>
    <option value="24x30_paper">&nbsp;&nbsp;24&quot; x 30&quot; - $75</option>
    <option value="24x36_paper">&nbsp;&nbsp;24&quot; x 36&quot; - $90</option>
    <option value="36x36_paper">&nbsp;&nbsp;36&quot; x 36&quot; - $135</option>    
    <option value="36x40_paper">&nbsp;&nbsp;36&quot; x 40&quot; - $150</option>
    <option value="40x40_paper">&nbsp;&nbsp;40&quot; x 40&quot; - $165</option>
    <option value="48x48_paper">&nbsp;&nbsp;48&quot; x 48&quot; - $240</option>
    <option value="60x60_paper">&nbsp;&nbsp;60&quot; x 60&quot; - $375</option>

    <optgroup label="Paper Canvas">Canvas</optgroup>
    <option value="8x10_canvas">&nbsp;&nbsp;8&quot; x 10&quot; - $10</option>
    <option value="9x12_canvas">&nbsp;&nbsp;9&quot; x 12&quot; - $15</option>
    <option value="11x14_canvas">&nbsp;&nbsp;11&quot; x 14&quot; (1)- $20</option>
    <option value="12x16_canvas">&nbsp;&nbsp;12&quot; x 16&quot; (1.3) - $26</option>
    <option value="14x18_canvas">&nbsp;&nbsp;14&quot; x 18&quot; (1.75)- $35</option>
    <option value="16x20_canvas">&nbsp;&nbsp;16&quot; x 20&quot; (2.2)- $44</option>
    <option value="18x24_canvas">&nbsp;&nbsp;18&quot; x 24&quot; (3)- $60</option>
    <option value="20x24_canvas">&nbsp;&nbsp;20&quot; x 24&quot; (3.3) - $66</option>
    <option value="24x30_canvas">&nbsp;&nbsp;24&quot; x 30&quot; (5) - $100</option>
    <option value="24x36_canvas">&nbsp;&nbsp;24&quot; x 36&quot; (6) - $120</option>
    <option value="36x36_canvas">&nbsp;&nbsp;36&quot; x 36&quot; (9) - $180</option>    
    <option value="36x40_canvas">&nbsp;&nbsp;36&quot; x 40&quot; (10) - $200</option>
    <option value="40x40_canvas">&nbsp;&nbsp;40&quot; x 40&quot; (11) - $220</option>
    <option value="48x48_canvas">&nbsp;&nbsp;48&quot; x 48&quot; (16) - $320</option>
    <option value="60x60_canvas">&nbsp;&nbsp;60&quot; x 60&quot; (25) - $500 </option>

        
    </select></p>
    <table border="1" width="100%">
        <tr>
            <td><b>
            <input type="radio" value="printonly" name="CanvasType" id="CanvasType" checked="yes" onclick="updateCosts();">Print
            Only</b> </td>
            <td>No additional charge</td>
        </tr>
        <tr>
            <td><b><input type="radio" value="museum" name="CanvasType" onclick="updateCosts();">Museum
            wrapped canvas 1.5&quot; thick</b></td>
            <td>$60 additional </td>
        </tr>
        <tr>
            <td><b><input type="radio" name="CanvasType" value="framefriendly" onclick="updateCosts();">Frame-Friendly
            wrapped canvas</b></td>
            <td>$40 additional </td>
        </tr>
    </table>
    <p><input type="text" name="TotalCost" size="20" readonly="yes"></p>
    <p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
   <td>No additional charge</td>
        </tr>
        <tr>
            <td><b><input type="radio" value="museum" name="CanvasType" onclick="updateCosts();">Museum
            wrapped canvas 1.5&quot; thick</b></td>
            <td>$60 additional </td>
        </tr>
        <tr>
            <td><b><input type="radio" name="CanvasType" value="framefriendly" onclick="updateCosts();">Frame-Friendly
            wrapped canvas</b></td>
            <td>$40 additional </td>
        </tr>
    </table>
    <p><input type="text" name="TotalCost" size="20" readonly="yes"></p>
    <p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>


``The wise man doesn't give the right answers,
he poses the right questions.''
TIMTOWTDI
 
Thanks - seems to have gone a little funky? (got duplicates of the whole page - LOL)

Cheers

Andy
 
sorry for the confusion i caused you guys

on your original script

change every instance of
Code:
document.costform.PaperSize.value

with this
Code:
document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value


and change this bit
Code:
alert(document.costform.CanvasType.value);
var theCost2;
if (document.costform.CanvasType.value == "framefriendly") {
        theCost2 = theCost + canvasframefriendly;
     } else if (document.costform.CanvasType.value == "museum") {
        theCost2 = theCost + canvasmuseum;
     } else { theCost2 = theCost; }

with this bit
Code:
var radioLength = document.costform.CanvasType.length;
    for(var i = 0; i < radioLength; i++) {
        if ( document.costform.CanvasType[i].checked ==true ){
            alert(document.costform.CanvasType[i].value);
            if (document.costform.CanvasType[i].value == "framefriendly") {
                theCost2 = theCost + canvasframefriendly;
            } else if (document.costform.CanvasType[i].value == "museum") {
                theCost2 = theCost + canvasmuseum;
            } else { theCost2 = theCost; }
        }
    }


``The wise man doesn't give the right answers,
he poses the right questions.''
TIMTOWTDI
 
Thanks - still not working though :(

Code:
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 2</title>
</head>

<body>

<script>

  function updateCosts() {
  
     var theCost;
  
     var paper_8x10 = '5';
     var paper_9x12 = '11';  
     var paper_11x14 = '15';
     var paper_12x16 = '19';
     var paper_14x18 = '26';
     var paper_16x20 = '33';
     var paper_18x24 = '45';
     var paper_20x24 = '49';
     var paper_24x30 = '75';
     var paper_24x36 = '90';
     var paper_36x36 = '135';
     var paper_36x40 = '150';
     var paper_40x40 = '165';
     var paper_48x48 = '240';
     var paper_60x60 = '375';
     
     var canvas_8x10 = '10';
     var canvas_9x12 = '15';  
     var canvas_11x14 = '20';
     var canvas_12x16 = '26';
     var canvas_14x18 = '35';
     var canvas_16x20 = '44';
     var canvas_18x24 = '60';
     var canvas_20x24 = '66';
     var canvas_24x30 = '100';
     var canvas_24x36 = '120';
     var canvas_36x36 = '180';
     var canvas_36x40 = '200';
     var canvas_40x40 = '220';
     var canvas_48x48 = '320';
     var canvas_60x60 = '500';     

     var canvasmuseum = '60';
     var canvasframefriendly = '40';
        
     if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "8x10_paper") {
        theCost = paper_8x10;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "9x12_paper") {
        theCost = paper_9x12;       
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "11x14_paper") {
        theCost = paper_11x14;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "12x16_paper") {
        theCost = paper_12x16;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "14x18_paper") {
        theCost = paper_14x18;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "16x20_paper") {
        theCost = paper_16x20;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "18x24_paper") {
        theCost = paper_18x24;        
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "20x24_paper") {
        theCost = paper_20x24;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "24x30_paper") {
        theCost = paper_24x30;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "24x36_paper") {
        theCost = paper_24x36;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "36x36_paper") {
        theCost = paper_36x36;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "36x40_paper") {
        theCost = paper_36x40;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "40x40_paper") {
        theCost = paper_40x40;                                        
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "48x48_paper") {
        theCost = paper_48x48;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "60x60_paper") {
        theCost = paper_60x60;   
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "8x10_canvas") {
        theCost = canvas_8x10;    
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "9x12_canvas") {
        theCost = canvas_9x12;       
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "11x14_canvas") {
        theCost = canvas_11x14;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "12x16_canvas") {
        theCost = canvas_12x16;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "14x18_canvas") {
        theCost = canvas_14x18;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "16x20_canvas") {
        theCost = canvas_16x20;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "18x24_canvas") {
        theCost = canvas_18x24;        
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "20x24_canvas") {
        theCost = canvas_20x24;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "24x30_canvas") {
        theCost = canvas_24x30;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "24x36_canvas") {
        theCost = canvas_24x36;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "36x36_canvas") {
        theCost = canvas_36x36;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "36x40_canvas") {
        theCost = canvas_36x40;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "40x40_canvas") {
        theCost = canvas_40x40;                                        
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "48x48_canvas") {
        theCost = canvas_48x48;
     } else if (document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value == "60x60_canvas") {
        theCost = canvas_60x60;   
     }

    var test = document.costform.CanvasType.options[document.costform.CanvasType.selectedIndex].value;

   alert(test);

/*
     var theCost2;
     if (document.costform.CanvasType.value == "framefriendly") {
        theCost2 = theCost + canvasframefriendly;
     } else if (document.costform.CanvasType.value == "museum") {
        theCost2 = theCost + canvasmuseum; 
     } else { theCost2 = theCost; }
     
*/

var radioLength = document.costform.CanvasType.length;
    for(var i = 0; i < radioLength; i++) {
        if ( document.costform.CanvasType[i].checked ==true ){
            alert(document.costform.CanvasType[i].value);
            if (document.costform.CanvasType[i].value == "framefriendly") {
                theCost2 = theCost + canvasframefriendly;
            } else if (document.costform.CanvasType[i].value == "museum") {
                theCost2 = theCost + canvasmuseum;
            } else { theCost2 = theCost; }
        }
    }
 
     alert("cost is: " + theCost);  
     document.costform.TotalCost.value = theCost2;
  
  }
</script>

		<form name="costform" method="POST" action="--WEBBOT-SELF--">
			<p><b>Print Size:</b>&nbsp; 
			<select size="1" name="PaperSize" onchange="updateCosts();">
			<option value="">-- SELECT TYPE --</option>
			<optgroup label="Paper Canvas">Paper
			</optgroup>
			<option value="8x10_paper">&nbsp;&nbsp;8&quot; x 10&quot; - $5
			</option>
			<option value="9x12_paper">&nbsp;&nbsp;9&quot; x 12&quot; - $11
			</option>
			<option value="11x14_paper">&nbsp;&nbsp;11&quot; x 14&quot; - $15
			</option>
			<option value="12x16_paper">&nbsp;&nbsp;12&quot; x 16&quot; - $19
			</option>
			<option value="14x18_paper">&nbsp;&nbsp;14&quot; x 18&quot; - $26
			</option>
			<option value="16x20_paper">&nbsp;&nbsp;16&quot; x 20&quot; - $33
			</option>
			<option value="18x24_paper">&nbsp;&nbsp;18&quot; x 24&quot; - $45
			</option>
			<option value="20x24_paper">&nbsp;&nbsp;20&quot; x 24&quot; - $49
			</option>
			<option value="24x30_paper">&nbsp;&nbsp;24&quot; x 30&quot; - $75
			</option>
			<option value="24x36_paper">&nbsp;&nbsp;24&quot; x 36&quot; - $90
			</option>
			<option value="36x36_paper">&nbsp;&nbsp;36&quot; x 36&quot; - $135
			</option>
			<option value="36x40_paper">&nbsp;&nbsp;36&quot; x 40&quot; - $150
			</option>
			<option value="40x40_paper">&nbsp;&nbsp;40&quot; x 40&quot; - $165
			</option>
			<option value="48x48_paper">&nbsp;&nbsp;48&quot; x 48&quot; - $240
			</option>
			<option value="60x60_paper">&nbsp;&nbsp;60&quot; x 60&quot; - $375
			</option>
			<optgroup label="Paper Canvas">Canvas
			</optgroup>
			<option value="8x10_canvas">&nbsp;&nbsp;8&quot; x 10&quot; - $10
			</option>
			<option value="9x12_canvas">&nbsp;&nbsp;9&quot; x 12&quot; - $15
			</option>
			<option value="11x14_canvas">&nbsp;&nbsp;11&quot; x 14&quot; (1)- $20
			</option>
			<option value="12x16_canvas">&nbsp;&nbsp;12&quot; x 16&quot; (1.3) - $26
			</option>
			<option value="14x18_canvas">&nbsp;&nbsp;14&quot; x 18&quot; (1.75)- $35
			</option>
			<option value="16x20_canvas">&nbsp;&nbsp;16&quot; x 20&quot; (2.2)- $44
			</option>
			<option value="18x24_canvas">&nbsp;&nbsp;18&quot; x 24&quot; (3)- $60
			</option>
			<option value="20x24_canvas">&nbsp;&nbsp;20&quot; x 24&quot; (3.3) - $66
			</option>
			<option value="24x30_canvas">&nbsp;&nbsp;24&quot; x 30&quot; (5) - $100
			</option>
			<option value="24x36_canvas">&nbsp;&nbsp;24&quot; x 36&quot; (6) - $120
			</option>
			<option value="36x36_canvas">&nbsp;&nbsp;36&quot; x 36&quot; (9) - $180
			</option>
			<option value="36x40_canvas">&nbsp;&nbsp;36&quot; x 40&quot; (10) - $200
			</option>
			<option value="40x40_canvas">&nbsp;&nbsp;40&quot; x 40&quot; (11) - $220
			</option>
			<option value="48x48_canvas">&nbsp;&nbsp;48&quot; x 48&quot; (16) - $320
			</option>
			<option value="60x60_canvas">&nbsp;&nbsp;60&quot; x 60&quot; (25) - $500 
			</option></select></p>
			<table border="1" width="100%">
				<tr>
					<td><b>
					<input type="radio" value="printonly" name="CanvasType"  checked="yes" onclick="updateCosts();">Print 
			Only</b> </td>
					<td>No additional charge</td>
				</tr>
				<tr>
					<td><b>
					<input type="radio" value="museum" name="CanvasType" onclick="updateCosts();">Museum 
			wrapped canvas 1.5&quot; thick</b></td>
					<td>$60 additional </td>
				</tr>
				<tr>
					<td><b>
					<input type="radio" name="CanvasType" value="framefriendly" onclick="updateCosts();">Frame-Friendly 
			wrapped canvas</b></td>
					<td>$40 additional </td>
				</tr>
			</table>
			<p><input type="text" name="TotalCost" size="20" readonly="yes"></p>
			<p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
		</form>




</body>

</html>

Same error :

Error: document.costform.CanvasType.selectedIndex has no properties
Source File: file:///C:/Users/Ace/Documents/My%20Web%20Sites/cart_print_rob.htm
Line: 113

:/

Cheers

Andy

 
also...because of the fact that javascript looks variables like strings if you use '60' unless specified otherwise...
you have to convert the variables theCost, canvasframefriendly, and canvasmuseum to numbers

probably using something like parseInt('theCost'), parseInt('canvasframefriendly') and parseInt('canvasmuseum')
in order for the add (+) to take place...

unless you meant not to actually add the numbers but display them next to each other


``The wise man doesn't give the right answers,
he poses the right questions.''
TIMTOWTDI
 
var test = document.costform.CanvasType.options[document.costform.CanvasType.selectedIndex].value;
this should not be CanvasType

it supposed to be PaperSize...you actually typed it above yourself ... i think you need some sleep yourself..like me :)
Code:
document.costform.PaperSize.options[document.costform.PaperSize.selectedIndex].value


``The wise man doesn't give the right answers,
he poses the right questions.''
TIMTOWTDI
 
Hi,

WAHOO - got it working right now =D

Star coming your way for your help - thanks much!

Working code - if any use to anyone in the future :)

Code:
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 2</title>
</head>

<body>

<script>

  function updateCosts() {
  
     var theCost;
  
     var paper_8x10 = 5;
     var paper_9x12 = 11; 
     var paper_11x14 = 15;
     var paper_12x16 = 19;
     var paper_14x18 = 26;
     var paper_16x20 = 33;
     var paper_18x24 = 45;
     var paper_20x24 = 49;
     var paper_24x30 = 75;
     var paper_24x36 = 90;
     var paper_36x36 = 135;
     var paper_36x40 = 150;
     var paper_40x40 = 165;
     var paper_48x48 = 240;
     var paper_60x60 = 375;
     
     var canvas_8x10 = 10;
     var canvas_9x12 = 15;  
     var canvas_11x14 = 20;
     var canvas_12x16 = 26;
     var canvas_14x18 = 35;
     var canvas_16x20 = 44;
     var canvas_18x24 = 60;
     var canvas_20x24 = 66;
     var canvas_24x30 = 100;
     var canvas_24x36 = 120;
     var canvas_36x36 = 180;
     var canvas_36x40 = 200;
     var canvas_40x40 = 220;
     var canvas_48x48 = 320;
     var canvas_60x60 = 500;     

     var canvasmuseum = 60;
     var canvasframefriendly = 40;
        
     if (document.costform.PaperSize.value == "8x10_paper") {
        theCost = paper_8x10;
     } else if (document.costform.PaperSize.value == "9x12_paper") {
        theCost = paper_9x12;       
     } else if (document.costform.PaperSize.value == "11x14_paper") {
        theCost = paper_11x14;
     } else if (document.costform.PaperSize.value == "12x16_paper") {
        theCost = paper_12x16;
     } else if (document.costform.PaperSize.value == "14x18_paper") {
        theCost = paper_14x18;
     } else if (document.costform.PaperSize.value == "16x20_paper") {
        theCost = paper_16x20;
     } else if (document.costform.PaperSize.value == "18x24_paper") {
        theCost = paper_18x24;        
     } else if (document.costform.PaperSize.value == "20x24_paper") {
        theCost = paper_20x24;
     } else if (document.costform.PaperSize.value == "24x30_paper") {
        theCost = paper_24x30;
     } else if (document.costform.PaperSize.value == "24x36_paper") {
        theCost = paper_24x36;
     } else if (document.costform.PaperSize.value == "36x36_paper") {
        theCost = paper_36x36;
     } else if (document.costform.PaperSize.value == "36x40_paper") {
        theCost = paper_36x40;
     } else if (document.costform.PaperSize.value == "40x40_paper") {
        theCost = paper_40x40;                                        
     } else if (document.costform.PaperSize.value == "48x48_paper") {
        theCost = paper_48x48;
     } else if (document.costform.PaperSize.value == "60x60_paper") {
        theCost = paper_60x60;   
     } else if (document.costform.PaperSize.value == "8x10_canvas") {
        theCost = canvas_8x10;    
     } else if (document.costform.PaperSize.value == "9x12_canvas") {
        theCost = canvas_9x12;       
     } else if (document.costform.PaperSize.value == "11x14_canvas") {
        theCost = canvas_11x14;
     } else if (document.costform.PaperSize.value == "12x16_canvas") {
        theCost = canvas_12x16;
     } else if (document.costform.PaperSize.value == "14x18_canvas") {
        theCost = canvas_14x18;
     } else if (document.costform.PaperSize.value == "16x20_canvas") {
        theCost = canvas_16x20;
     } else if (document.costform.PaperSize.value == "18x24_canvas") {
        theCost = canvas_18x24;        
     } else if (document.costform.PaperSize.value == "20x24_canvas") {
        theCost = canvas_20x24;
     } else if (document.costform.PaperSize.value == "24x30_canvas") {
        theCost = canvas_24x30;
     } else if (document.costform.PaperSize.value == "24x36_canvas") {
        theCost = canvas_24x36;
     } else if (document.costform.PaperSize.value == "36x36_canvas") {
        theCost = canvas_36x36;
     } else if (document.costform.PaperSize.value == "36x40_canvas") {
        theCost = canvas_36x40;
     } else if (document.costform.PaperSize.value == "40x40_canvas") {
        theCost = canvas_40x40;                                        
     } else if (document.costform.PaperSize.value == "48x48_canvas") {
        theCost = canvas_48x48;
     } else if (document.costform.PaperSize.value == "60x60_canvas") {
        theCost = canvas_60x60;   
     }


/*
     var theCost2;
     if (document.costform.CanvasType.value == "framefriendly") {
        theCost2 = theCost + canvasframefriendly;
     } else if (document.costform.CanvasType.value == "museum") {
        theCost2 = theCost + canvasmuseum; 
     } else { theCost2 = theCost; }
     
*/

     var theCost2;
     var radioLength = document.costform.CanvasType.length;
    for(var i = 0; i < radioLength; i++) {
        if ( document.costform.CanvasType[i].checked ==true ){
            if (document.costform.CanvasType[i].value == "framefriendly") {
                theCost2 = theCost + canvasframefriendly;
            } else if (document.costform.CanvasType[i].value == "museum") {
                theCost2 = theCost + canvasmuseum;
            } else { theCost2 = theCost; }
        }
    }
 
     document.costform.TotalCost.value = theCost2;
  
  }
</script>

		<form name="costform" method="POST" action="--WEBBOT-SELF--">
			<p><b>Print Size:</b>&nbsp; 
			<select size="1" name="PaperSize" onchange="updateCosts();">
			<option value="">-- SELECT TYPE --</option>
			<optgroup label="Paper Canvas">Paper
			</optgroup>
			<option value="8x10_paper">&nbsp;&nbsp;8&quot; x 10&quot; - $5
			</option>
			<option value="9x12_paper">&nbsp;&nbsp;9&quot; x 12&quot; - $11
			</option>
			<option value="11x14_paper">&nbsp;&nbsp;11&quot; x 14&quot; - $15
			</option>
			<option value="12x16_paper">&nbsp;&nbsp;12&quot; x 16&quot; - $19
			</option>
			<option value="14x18_paper">&nbsp;&nbsp;14&quot; x 18&quot; - $26
			</option>
			<option value="16x20_paper">&nbsp;&nbsp;16&quot; x 20&quot; - $33
			</option>
			<option value="18x24_paper">&nbsp;&nbsp;18&quot; x 24&quot; - $45
			</option>
			<option value="20x24_paper">&nbsp;&nbsp;20&quot; x 24&quot; - $49
			</option>
			<option value="24x30_paper">&nbsp;&nbsp;24&quot; x 30&quot; - $75
			</option>
			<option value="24x36_paper">&nbsp;&nbsp;24&quot; x 36&quot; - $90
			</option>
			<option value="36x36_paper">&nbsp;&nbsp;36&quot; x 36&quot; - $135
			</option>
			<option value="36x40_paper">&nbsp;&nbsp;36&quot; x 40&quot; - $150
			</option>
			<option value="40x40_paper">&nbsp;&nbsp;40&quot; x 40&quot; - $165
			</option>
			<option value="48x48_paper">&nbsp;&nbsp;48&quot; x 48&quot; - $240
			</option>
			<option value="60x60_paper">&nbsp;&nbsp;60&quot; x 60&quot; - $375
			</option>
			<optgroup label="Paper Canvas">Canvas
			</optgroup>
			<option value="8x10_canvas">&nbsp;&nbsp;8&quot; x 10&quot; - $10
			</option>
			<option value="9x12_canvas">&nbsp;&nbsp;9&quot; x 12&quot; - $15
			</option>
			<option value="11x14_canvas">&nbsp;&nbsp;11&quot; x 14&quot; (1)- $20
			</option>
			<option value="12x16_canvas">&nbsp;&nbsp;12&quot; x 16&quot; (1.3) - $26
			</option>
			<option value="14x18_canvas">&nbsp;&nbsp;14&quot; x 18&quot; (1.75)- $35
			</option>
			<option value="16x20_canvas">&nbsp;&nbsp;16&quot; x 20&quot; (2.2)- $44
			</option>
			<option value="18x24_canvas">&nbsp;&nbsp;18&quot; x 24&quot; (3)- $60
			</option>
			<option value="20x24_canvas">&nbsp;&nbsp;20&quot; x 24&quot; (3.3) - $66
			</option>
			<option value="24x30_canvas">&nbsp;&nbsp;24&quot; x 30&quot; (5) - $100
			</option>
			<option value="24x36_canvas">&nbsp;&nbsp;24&quot; x 36&quot; (6) - $120
			</option>
			<option value="36x36_canvas">&nbsp;&nbsp;36&quot; x 36&quot; (9) - $180
			</option>
			<option value="36x40_canvas">&nbsp;&nbsp;36&quot; x 40&quot; (10) - $200
			</option>
			<option value="40x40_canvas">&nbsp;&nbsp;40&quot; x 40&quot; (11) - $220
			</option>
			<option value="48x48_canvas">&nbsp;&nbsp;48&quot; x 48&quot; (16) - $320
			</option>
			<option value="60x60_canvas">&nbsp;&nbsp;60&quot; x 60&quot; (25) - $500 
			</option></select></p>
			<table border="1" width="100%">
				<tr>
					<td><b>
					<input type="radio" value="printonly" name="CanvasType"  checked="yes" onclick="updateCosts();">Print 
			Only</b> </td>
					<td>No additional charge</td>
				</tr>
				<tr>
					<td><b>
					<input type="radio" value="museum" name="CanvasType" onclick="updateCosts();">Museum 
			wrapped canvas 1.5&quot; thick</b></td>
					<td>$60 additional </td>
				</tr>
				<tr>
					<td><b>
					<input type="radio" name="CanvasType" value="framefriendly" onclick="updateCosts();">Frame-Friendly 
			wrapped canvas</b></td>
					<td>$40 additional </td>
				</tr>
			</table>
			<p><input type="text" name="TotalCost" size="20" readonly="yes"></p>
			<p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
		</form>




</body>

</html>


Cheers

Andy
 
thanks for the star mate...sorry for the confusion i caused you last night...I was too tired....


``The wise man doesn't give the right answers,
he poses the right questions.''
TIMTOWTDI
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top