...

View Full Version : Could really do with a hand



Anto
12-09-2006, 11:25 PM
Hi,

I've really tried to work this out but I can't.. I've read up on variable functions but can't get the link right.

I place a variable in the beginning of the JS such as:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

var mx="5.73";

function doMath(s) {
var form = document.getElementsByName(s)[0];
var one = parseFloat(form.con1.value);
var two = parseFloat(form.cable.value);
var three = parseFloat(form.length.value);
var four = parseFloat(form.con2.value);
var five = 0.0;
if (form.con3) {
five = parseFloat(form.con3.value);
}
var prod = (two * three) + one + four + five;

form.amount.value=custRound(prod,3);
}

function custRound(x,places) {
return (Math.round(x*Math.pow(10,places)))/Math.pow(10,places)
}

// End -->

But I can't get it to control the HTML. What I have in there is:

<select name="con1">
<option value="createElement('mx')"selected>Male XLR</option>
<option value="6.26">Female XLR</option>
<option value="6.83">Stereo Jack (TRS)</option>
<option value="5.70">Mono Jack</option>
<option value="4.05">Phono (RCA)</option>
<option value="4.05">Minijack</option>


Please give me a clue to what I'm doing wrong. I tried to figure it out but have failed..

Thanks in advance

Anto

david_kw
12-09-2006, 11:38 PM
Did you look at my response to your last post about this question?

http://www.codingforums.com/showthread.php?t=102598

david_kw

Anto
12-09-2006, 11:57 PM
Never saw that until now.. Thank you so much!! I was pulling my hair out. I'll have a look to see if I can understand it..

Thank you again

Anto



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum