|
-
April 3rd, 2007, 10:35 AM
#8
Re: need help adding values in a javascript
I have made some enhancements and need to know how to use values in the sex pull down menu on the calculate function.
Thanks in advance
Code:
<HTML>
<head>
<TITLE>Competition</TITLE>
<style>
table
{
border:7px double #808080;
width:10%;
background-color:#f0f0f0;
}
th
{
font-family:Verdana;
font-size:12px;
color:#0979ff;
background-color:#cccccc;
text-align:center;
}
td
{
text-align:left;
}
.w42{width:42px;}
.w42{width:42px;}
.w55{width:55px;}
.w123{width:123px;}
.w70{width:70px;}
.inps
{
font-family:Arial;
font-size:14px;
font-weight:500;
text-align:center;
color:#000000;
background-color:#ffffff;
}
</style>
<script>
function calculation()
{
if(document.getElementById("in11").value && document.getElementById("in15").value)
{
document.getElementById("in16").value = Math.abs(document.getElementById("in11").value) + Math.abs(document.getElementById("in15").value);
if( document.getElementById("in3").selectedIndex.value == 1)
{
// for men
document.getElementById("in17").value = document.getElementById("in16").value* Math.pow(10,0.845716976 * (Math.pow(Math.log(document.getElementById("in7").value / 168.091) / Math.log(10),2))) ;
}
if( document.getElementById("in3").selectedIndex.value == 2)
{
// for female
document.getElementById("in17").value = document.getElementById("in16").value* Math.pow(10,1.316081431 * (Math.pow(Math.log(document.getElementById("in7").value / 107.844) / Math.log(10),2))) ;
}
}
if(document.getElementById("in25").value && document.getElementById("in29").value)
{
document.getElementById("in30").value = Math.abs(document.getElementById("in25").value) + Math.abs(document.getElementById("in29").value);
}
if(document.getElementById("in41").value && document.getElementById("in45").value)
{
document.getElementById("in46").value = Math.abs(document.getElementById("in41").value) + Math.abs(document.getElementById("in45").value);
}
if(document.getElementById("in57").value && document.getElementById("in61").value)
{
document.getElementById("in62").value = Math.abs(document.getElementById("in57").value) + Math.abs(document.getElementById("in61").value);
}
if(document.getElementById("in73").value && document.getElementById("in77").value)
{
document.getElementById("in78").value = Math.abs(document.getElementById("in73").value) + Math.abs(document.getElementById("in77").value);
}
if(document.getElementById("in89").value && document.getElementById("in93").value)
{
document.getElementById("in94").value = Math.abs(document.getElementById("in89").value) + Math.abs(document.getElementById("in93").value);
}
}
</SCRIPT>
</head>
<BODY>
<form>
<table>
<tr>
<th class="w42">KG Class</th>
<th class="w42">YOB</th>
<th class="w42">sex</th>
<th class="w123">Name</th>
<th class="w42">Lot #</th>
<th class="w123">Club</th>
<th class="w55">BWT</th>
<th class="w55">Snatch1</th>
<th class="w55">Snatch2</th>
<th class="w55">Snatch3</th>
<th class="w55">Best Snatch</th>
<th class="w42">C&J1</th>
<th class="w42">C&J2</th>
<th class="w42">C&J3</th>
<th class="w42">Best C&J</th>
<th class="w42">Total</th>
<th class="w70">Sinclair</th>
<th class="w42">Place</th>
</tr>
<tr>
<td><input id="in1" class="w42 inps" type="text"></td>
<td><input id="in2" class="w42 inps" type="text"></td>
<td><select name="in3"
<option value=0></option>
<option value=1>M</option>
<option value=2>F</option>
</select>
</td>
<td><input id="in4" class="w123 inps" type="text"></td>
<td><input id="in5" class="w42 inps" type="text"></td>
<td><input id="in6" class="w123 inps" type="text"></td>
<td><input id="in7" class="w55 inps" type="text"></td>
<td><input id="in8" class="w55 inps" type="text"></td>
<td><input id="in9" class="w55 inps" type="text"></td>
<td><input id="in10" class="w55 inps" type="text"></td>
<td><input id="in11" class="w55 inps" type="text"></td>
<td><input id="in12" class="w42 inps" type="text"></td>
<td><input id="in13" class="w42 inps" type="text"></td>
<td><input id="in14" class="w42 inps" type="text"></td>
<td><input id="in15" class="w42 inps" type="text"></td>
<td><input id="in16" class="w42 inps" type="text"></td>
<td><input id="in17" class="w70 inps" type="text"></td>
<td><input id="in18" class="w42 inps" type="text"></td>
</tr>
<tr>
<td><input id="in19" class="w42 inps" type="text"></td>
<td><input id="in20" class="w42 inps" type="text"></td>
<td><select name="in21"
<option value=0></option>
<option value=1>M</option>
<option value=2>F</option>
</select>
</td>
<td><input id="in22" class="w123 inps" type="text"></td>
<td><input id="in23" class="w42 inps" type="text"></td>
<td><input id="in24" class="w123 inps" type="text"></td>
<td><input id="in25" class="w55 inps" type="text"></td>
<td><input id="in26" class="w55 inps" type="text"></td>
<td><input id="in27" class="w55 inps" type="text"></td>
<td><input id="in28" class="w55 inps" type="text"></td>
<td><input id="in29" class="w55 inps" type="text"></td>
<td><input id="in30" class="w42 inps" type="text"></td>
<td><input id="in31" class="w42 inps" type="text"></td>
<td><input id="in32" class="w42 inps" type="text"></td>
<td><input id="in33" class="w42 inps" type="text"></td>
<td><input id="in34" class="w42 inps" type="text"></td>
<td><input id="in35" class="w70 inps" type="text"></td>
<td><input id="in36" class="w42 inps" type="text"></td>
</tr>
<tr>
<td><input id="in37" class="w42 inps" type="text"></td>
<td><input id="in18" class="w42 inps" type="text"></td>
<td><select name="in39"
<option value=0></option>
<option value=1>M</option>
<option value=2>F</option>
</select>
</td>
<td><input id="in34" class="w123 inps" type="text"></td>
<td><input id="in35" class="w42 inps" type="text"></td>
<td><input id="in36" class="w123 inps" type="text"></td>
<td><input id="in37" class="w55 inps" type="text"></td>
<td><input id="in38" class="w55 inps" type="text"></td>
<td><input id="in39" class="w55 inps" type="text"></td>
<td><input id="in40" class="w55 inps" type="text"></td>
<td><input id="in41" class="w55 inps" type="text"></td>
<td><input id="in42" class="w42 inps" type="text"></td>
<td><input id="in43" class="w42 inps" type="text"></td>
<td><input id="in44" class="w42 inps" type="text"></td>
<td><input id="in45" class="w42 inps" type="text"></td>
<td><input id="in46" class="w42 inps" type="text"></td>
<td><input id="in47" class="w70 inps" type="text"></td>
<td><input id="in48" class="w42 inps" type="text"></td>
</tr>
<tr>
<td><input id="in49" class="w42 inps" type="text"></td>
<td><input id="in17" class="w42 inps" type="text"></td>
<td><select name="in3"
<option value=0></option>
<option value=1>M</option>
<option value=2>F</option>
</select>
</td>
<td><input id="in50" class="w123 inps" type="text"></td>
<td><input id="in51" class="w42 inps" type="text"></td>
<td><input id="in52" class="w123 inps" type="text"></td>
<td><input id="in53" class="w55 inps" type="text"></td>
<td><input id="in54" class="w55 inps" type="text"></td>
<td><input id="in55" class="w55 inps" type="text"></td>
<td><input id="in56" class="w55 inps" type="text"></td>
<td><input id="in57" class="w55 inps" type="text"></td>
<td><input id="in58" class="w42 inps" type="text"></td>
<td><input id="in59" class="w42 inps" type="text"></td>
<td><input id="in60" class="w42 inps" type="text"></td>
<td><input id="in61" class="w42 inps" type="text"></td>
<td><input id="in62" class="w42 inps" type="text"></td>
<td><input id="in63" class="w70 inps" type="text"></td>
<td><input id="in64" class="w42 inps" type="text"></td>
</tr>
<tr>
<td><input id="in65" class="w42 inps" type="text"></td>
<td><input id="in17" class="w42 inps" type="text"></td>
<td><select name="in3"
<option value=0></option>
<option value=1>M</option>
<option value=2>F</option>
</select>
</td>
<td><input id="in66" class="w123 inps" type="text"></td>
<td><input id="in67" class="w42 inps" type="text"></td>
<td><input id="in68" class="w123 inps" type="text"></td>
<td><input id="in69" class="w55 inps" type="text"></td>
<td><input id="in70" class="w55 inps" type="text"></td>
<td><input id="in71" class="w55 inps" type="text"></td>
<td><input id="in72" class="w55 inps" type="text"></td>
<td><input id="in73" class="w55 inps" type="text"></td>
<td><input id="in74" class="w42 inps" type="text"></td>
<td><input id="in75" class="w42 inps" type="text"></td>
<td><input id="in76" class="w42 inps" type="text"></td>
<td><input id="in77" class="w42 inps" type="text"></td>
<td><input id="in78" class="w42 inps" type="text"></td>
<td><input id="in79" class="w70 inps" type="text"></td>
<td><input id="in80" class="w42 inps" type="text"></td>
</tr>
<tr>
<td><input id="in81" class="w42 inps" type="text"></td>
<td><input id="in17" class="w42 inps" type="text"></td>
<td><select name="in3"
<option value=0></option>
<option value=1>M</option>
<option value=2>F</option>
</select>
</td>
<td><input id="in82" class="w123 inps" type="text"></td>
<td><input id="in83" class="w42 inps" type="text"></td>
<td><input id="in84" class="w123 inps" type="text"></td>
<td><input id="in85" class="w55 inps" type="text"></td>
<td><input id="in86" class="w55 inps" type="text"></td>
<td><input id="in87" class="w55 inps" type="text"></td>
<td><input id="in88" class="w55 inps" type="text"></td>
<td><input id="in89" class="w55 inps" type="text"></td>
<td><input id="in90" class="w42 inps" type="text"></td>
<td><input id="in91" class="w42 inps" type="text"></td>
<td><input id="in92" class="w42 inps" type="text"></td>
<td><input id="in93" class="w42 inps" type="text"></td>
<td><input id="in94" class="w42 inps" type="text"></td>
<td><input id="in95" class="w70 inps" type="text"></td>
<td><input id="in96" class="w42 inps" type="text"></td>
</tr>
<tr>
<td colspan=16>
<input type="button" onClick="calculation()" value="Calculate Total">
<input type="reset" value="Reset All Data">
</td>
</tr>
</table>
</form>
</BODY>
</HTML>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|