I am trying to do a function that will perform automatic calculations based on user selections. I believe that the relevant values are stored in the array properly, but I am having trouble so that, for instance, if a user selects a template type from a drop down box, that the price associated with the template type is displayed in a text box. Here is my form code:

<form id="website" name="website" action="mailto:apd15@hotmail.co.uk" method="post" onsubmit="return ValidatePaymentDetails();">
 <p><b><u>Website Details Form</b></u></p>
 Website Template:
 <select id="templatetype" name="templatetype" onChange="getTotal()">
 <option>Select a Template Type</option>
 <option value = "con">Construction</option>
  <option value = "it">IT</option>
   <option value = "eng">Engineering</option>
    <option value = "pub">Public Services</option>
Images? (5 more per page):
<input type="radio" name="images" value="Yes"/>Yes<input type="radio" name="images" value="No"/>No<br>
 Number Of Pages Desired (10 Maximum) :
 <select name="pagenum">
 <option>Select A Number Of Pages</option>
 Total Price:<input type="text" name="totalprice" id = "totalprice" readonly="readonly"><br>
And here is my calculation JavaScript code so far:

function getTempPrice()
	var template_type = new Array();
	var tempPrice=0;
	var theForm = document.forms["website"];
	var selectedTemplate=theForm.elements["templatetype"];
	tempPrice = template_type[selectedTemplate.selectedIndex];
	alert (tempPrice);
	return tempPrice;

function getTotal()
	var webPrice = getTempPrice();
	var result=document.forms["website"]["totalprice"] = webPrice;
I would like the relevant price displayed in the "totalprice" text box, but I believe that a getElementByID line of code will be required, but I cannot seem to get it working when I tried.

Any help is appreciated!