I'm trying to take the value selected from a pull-down (<select>) list and have it display in another part of the web page. It works fine in Firefox but not in Internet Explorer (it comes up as the number zero no matter what number you choose). I know there is a known issue in IE with reading values like this, but I cannot figure out how to make this work. Thanks for taking a look.

<script TYPE="text/javascript">
function calculate_answer(form){

//grab value from select box
var theanswer=form.q22.value;

//multiple that by 1.4
theanswer=theanswer*1.4;

//round off to whole number
theanswer=Math.round(theanswer);

//this is the object where answer will be placed
key=document.getElementById("answer_goes_here");

The calculated number is <span ID="answer_goes_here">(Answer to Q22 goes here)</span>

</form>

Arty Effem

08-20-2007, 10:47 PM

Hi,

I'm trying to take the value selected from a pull-down (<select>) list and have it display in another part of the web page. It works fine in Firefox but not in Internet Explorer (it comes up as the number zero no matter what number you choose). I know there is a known issue in IE with reading values like this, but I cannot figure out how to make this work. Thanks for taking a look.
It's not an issue, it's a matter of complete HTML. Try assigning values to the options.

grantman

08-20-2007, 10:53 PM

Wow, how did I miss that? Thanks. I wasted several hours on this thinking that IE had a javascript bug that I had to work around when it was just being strict about the form values.