Please solve the following problem

admin

Administrator
Staff member
Hello All
I have changed other page to fit my demand in the following codes ,as you see below we have a function named addrepair which it had given the valur of number argument from the number field that user enter for example 2 or 3 ,Now I want to change it I want to pass the number to the addrepair function according the number I choose from the select box("component_select) for example if I choose component_1 and component_2 and component_4 it pass 3 to the function addrepair
Sincerley Mohsen


<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<SCRIPT language=JavaScript>
<!-- This script is written by Speedpete. -->
<!-- You may copy it freely -->

function addRepair(number) {
data = "";
inter = "'";

if (number < 17 && number > -1) {

for (i=1; i <= number; i++){

displaycount = i + 1;

//because a seperate table didn't work, a lot of spaces are needed
data = data + "<strong>Repair " + displaycount + "</strong>&nbsp;&nbsp;<select name=repairtype" + displaycount + " id=repairtype" + displaycount + " align='top'><option value='http://www.webdeveloper.com/forum/archive/index.php/12'>Alignment</option><option value='http://www.webdeveloper.com/forum/archive/index.php/5'>Battery</option><option value='http://www.webdeveloper.com/forum/archive/index.php/13'>Brakes</option><option value='http://www.webdeveloper.com/forum/archive/index.php/10'>Maintainence</option><option value='http://www.webdeveloper.com/forum/archive/index.php/9'>Major Repair</option><option value='http://www.webdeveloper.com/forum/archive/index.php/8'>Minor Repair</option><option value='http://www.webdeveloper.com/forum/archive/index.php/2'>Oil</option><option value='http://www.webdeveloper.com/forum/archive/index.php/3'>Oil Change</option><option value='http://www.webdeveloper.com/forum/archive/index.php/14'>Other</option><option value='http://www.webdeveloper.com/forum/archive/index.php/11'>State Inspection</option><option value='http://www.webdeveloper.com/forum/archive/index.php/4'>Tires</option><option value='http://www.webdeveloper.com/forum/archive/index.php/6'>Tune Up</option><option value='http://www.webdeveloper.com/forum/archive/index.php/7'>Washing</option></select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>Qty @ Cost</strong><input name='quantity" + displaycount + "' type='text' size='6' maxlength='6' align='top'> @ <input align='top' name='repaircost" + displaycount + "' type='text' id='repaircost" + displaycount + "' size='10' maxlength='10'><BR>";
}

finalcount = displaycount;
data = data + "<input type=hidden name=repaircount id=repaircount value=http://www.webdeveloper.com/forum/archive/index.php/" + finalcount + ">";

if (document.layers) {
document.layers.repairlist.document.write(data);
document.layers.repairlist.document.close();
}

else {
if(document.getElementById) {
document.getElementById('repairlist').innerHTML = data;
}
else {
return;
}
}
}
else {
window.alert("There's a maximum of 15 entries.")
}
}
</SCRIPT>

</head>
<META content="MSHTML 5.00.2920.0" name=GENERATOR>


<body>
Add Expense

<P><STRONG>Howmany Rent option Do you have?</STRONG></P>
<FORM id=counter name=counter>
<p>
<SELECT multiple name="component-select">

<OPTION>Component_3</OPTION>
<OPTION>Component_4</OPTION>
<OPTION>Component_5</OPTION>
<OPTION>Component_6</OPTION>
<OPTION>Component_7</OPTION>
</SELECT>
</p>



&nbsp;&nbsp;
<INPUT onclick=addRepair(counter.number.value) type=button value=http://www.webdeveloper.com/forum/archive/index.php/"Set Number">
</FORM>
<FORM action=/expenses_processor.cfm method=post name=addedit
onsubmit="return _CF_checkaddedit(this)">

<STRONG>Rent price</STRONG>&nbsp;
<input
name=repairtype1 type=hidden value=1> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<STRONG>Qty
@ Cost</STRONG> <INPUT align=top maxLength=6 name=quantity1 size=6>
@
<INPUT align=top id=repaircost1 maxLength=10 name=repaircost1
size=10> <BR>

<DIV id=repairlist style="POSITION: relative"
name="repairlist"></DIV>

<INPUT name=Submit type=submit value="Add Repair"> &nbsp;&nbsp;&nbsp;&nbsp;
<INPUT name=reset type=reset value="Clear Form">

</FORM>

</body>
</html>
 
Back
Top