我有一个表单,我无法控制要编辑的 php。我需要它,以便在它发送值时发送项目的描述,但我需要该值来添加总计字段的价格。有没有办法进行设置,以便我可以发送项目的描述,但仍将值保留为数字,以便添加总数?
<div id="cid_7" class="form-input">
<select class="form-dropdown validate[required]" onchange="code(1)" style="width:150px" id="input_7" name="q7_ticketOptions">
<option> </option>
<option value="300"> VIP Floor Seats - $300.00 </option>
<option value="40"> Section 101 Upper Level - $40.00 </option>
<option value="60"> Section 101 Mid Level - $60.00 </option>
<option value="150"> Section 101 Lower Level - $150.00 </option>
<option value="40"> Section 102 Upper Level - $40.00 </option>
<option value="60"> Section 102 Mid Level - $60.00 </option>
<option value="150"> Section 102 Lower Level - $150.00 </option>
<option value="40"> Section 103 Upper Level - $40.00 </option>
<option value="60"> Section 103 Mid Level - $60.00 </option>
<option value="150"> Section 103 Lower Level - $150.00 </option>
<option value="20"> Section 104 Upper Level - $20.00 </option>
<option value="60"> Section 104 Mid Level - $60.00 </option>
<option value="20"> Section 107 Upper Level - $20.00 </option>
<option value="60"> Section 107 Mid Level - $60.00 </option>
<option value="40"> Section 108 Upper Level - $40.00 </option>
<option value="60"> Section 108 Mid Level - $60.00 </option>
<option value="150"> Section 108 Lower Level - $150.00 </option>
<option value="40"> Section 109 Upper Level - $40.00 </option>
<option value="60"> Section 109 Mid Level - $60.00 </option>
<option value="150"> Section 109 Lower Level - $150.00 </option>
<option value="40"> Section 110 Upper Level - $40.00 </option>
<option value="60"> Section 110 Mid Level - $60.00 </option>
<option value="150"> Section 110 Lower Level - $150.00 </option>
<option value="40"> Section 111 Upper Level - $40.00 </option>
<option value="60"> Section 111 Mid Level - $60.00 </option>
<option value="150"> Section 111 Lower Level - $150.00 </option>
<option value="40"> Section 112 Upper Level - $40.00 </option>
<option value="60"> Section 112 Mid Level - $60.00 </option>
<option value="150"> Section 112 Lower Level - $150.00 </option>
<option value="20"> Section 113 Upper Level - $20.00 </option>
<option value="60"> Section 113 Mid Level - $60.00 </option>
<option value="40"> Section 114 Upper Level - $40.00 </option>
<option value="60"> Section 114 Mid Level - $60.00 </option>
<option value="40"> Section 115 Upper Level - $40.00 </option>
<option value="60"> Section 115 Mid Level - $60.00 </option>
<option value="20"> Section 116 Upper Level - $20.00 </option>
<option value="60"> Section 116 Mid Level - $60.00 </option>
<option value="40"> Section 117 Upper Level - $40.00 </option>
<option value="60"> Section 117 Mid Level - $60.00 </option>
<option value="150"> Section 117 Lower Level - $150.00 </option>
<option value="40"> Section 118 Upper Level - $40.00 </option>
<option value="60"> Section 118 Mid Level - $60.00 </option>
<option value="150"> Section 118 Lower Level - $150.00 </option>
</select>
</div>
</li>
<li class="form-line" id="id_23">
<label class="form-label-left" id="label_23" for="input_23"> Quantity<span class="form-required">*</span></label>
<div id="cid_23" class="form-input">
<select class="form-dropdown validate[required]" onchange="code(2)" style="width:150px" id="input_23" name="q23_quantity">
<option> </option>
<option value="1"> 1 </option>
<option value="2"> 2 </option>
<option value="3"> 3 </option>
<option value="4"> 4 </option>
<option value="5"> 5 </option>
<option value="6"> 6 </option>
<option value="7"> 7 </option>
<option value="8"> 8 </option>
<option value="9"> 9 </option>
<option value="10"> 10 </option>
</select>
</div>
</li>
<li class="form-line" id="id_22">
<label class="form-label-right" id="label_22" for="cost">Total $</label>
<div id="cid_22" class="form-input">
<input type="text" name="q22_total" id="cost" onfocus="this.blur()" style="width:50px"/>
</div>
</li>
这是Javasript:
<script type="text/javascript">
function code() { // forget the parameter
var varone = document.getElementById('input_7');
var vartwo = document.getElementById('input_23');
var cost = document.getElementById('cost');
var total = parseFloat(varone.value) * parseFloat(vartwo.value);
cost.value = total;
}
</script>