[RESOLVED] Help Please
Can anyone tell me why I can not get these two forms to work on the same page? Values shorted due to size.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Square Awning Cover</title>
</head>
<body>
<form method="POST" action="#" id="form1">
<p class="left" align="left"><font color="#FF7500" size="2">Square
Awning Cover</font></p>
<p class="left" align="left" style="margin-top: 0px"><font size="2">Fabric Class:</font><font size="1">
<select size="1" name="select1">
<option selected value="K">K</option>
<option value="P">P</option>
<option value="P+10">P+10</option>
<option value="P+15">P+15</option>
<option value="P+25">P+25</option>
<option value="P+80">P+80</option></select></font></p>
<p class="left" align="left" style="margin-top: 0px"><font size="2">Combined Drop & Projection:
</font><font size="1"><select size="1" name="select2">
<option value="3-0" selected>3-0</option>
<option value="4-0">4-0</option>
<option value="5-0">5-0</option>
<option value="6-0">6-0</option>
<option value="7-0">7-0</option>
<option value="8-0">8-0</option>
<option value="9-0">9-0</option>
<option value="10-0">10-0</option>
<option value="11-0">11-0</option>
<option value="12-0">12-0</option></select></font><font size="2">
Width:</font><font size="1"> <select size="1" name="select3">
<option value="3-0" selected>3-0</option>
<option value="4-0">4-0</option>
<option value="5-0">5-0</option>
<option value="6-0">6-0</option>
<option value="7-0">7-0</option>
<option value="8-0">8-0</option>
<option value="9-0">9-0</option>
<option value="10-0">10-0</option>
<option value="11-0">11-0</option>
<option value="12-0">12-0</option>
<option value="13-0">13-0</option>
<option value="14-0">14-0</option>
<option value="15-0">15-0</option>
<option value="16-0">16-0</option>
<option value="17-0">17-0</option>
<option value="18-0">18-0</option>
<option value="19-0">19-0</option>
<option value="20-0">20-0</option>
<option value="21-0">21-0</option>
<option value="22-0">22-0</option>
<option value="23-0">23-0</option>
<option value="24-0">24-0</option>
<option value="25-0">25-0</option>
<option value="26-0">26-0</option>
<option value="27-0">27-0</option>
<option value="28-0">28-0</option>
<option value="29-0">29-0</option>
<option value="30-0">30-0</option></select></font></p>
<p class="left" align="left" style="margin-top: 0px"> </p>
<p class="left" align="center" style="margin-top: 0px"><font size="2">
<button type="submit" style="width: 92px; height: 22px"><font size="1">Get Dealer Cost</font>
</button></font> <input type="text" name="price" value="" readonly="readonly" size="5"></font><p class="left" align="center" style="margin-top: 0px"> <script type="text/javascript">
<!--
function cost() {
var price=[];
price[0]=[
[93, 106, 117, 127, 136, 144, 161, 173, 200, 239],
[106, 117, 130, 139, 144, 161, 173, 200, 215, 263],
[356, 399, 413, 491, 504, 525, 599, 628, 673, 702]
];
price[1]=[
[109, 118, 133, 142, 151, 161, 179, 196, 228, 269],
[118, 133, 142, 151, 161, 179, 196, 228, 246, 297],
[415, 449, 482, 516, 557, 597, 638, 674, 710, 744]
];
price[2]=[
[121, 131, 147, 157, 167, 179, 199, 219, 255, 390],
[131, 147, 157, 167, 179, 199, 219, 253, 276, 428],
[460, 497, 534, 572, 617, 661, 705, 745, 784, 1204]
];
price[3]=[
[127, 138, 154, 165, 175, 188, 208, 230, 268, 396],
[138, 154, 165, 175, 188, 208, 230, 265, 291, 435],
[482, 521, 559, 600, 647, 693, 739, 781, 822, 1226]
];
price[4]=[
[139, 151, 169, 180, 191, 206, 228, 253, 295, 408],
[151, 169, 180, 191, 206, 228, 253, 290, 320, 448],
[527, 570, 611, 655, 706, 757, 807, 852, 896, 1271]
];
price[5]=[
[203, 224, 247, 263, 280, 304, 336, 378, 443, 472],
[224, 247, 263, 280, 304, 336, 378, 425, 484, 521],
[774, 835, 895, 962, 1035, 1107, 1177, 1242, 1305, 1518]
];
var f=document.getElementById('form1');
f['price'].value='$'+price[f['select1'].selectedIndex][f['select3'].selectedIndex][f['select2'].selectedIndex];
return false;}
if(document.getElementById) {
window.onload=function() {
document.getElementById('form1').onsubmit=cost;
document.getElementsByName('price')[0].type='text';
document.getElementsByName('price')[0].onfocus=function() {this.blur();};
};
}
//-->
</script><img src="images/hr02.gif" alt="" width="417" height="10" border="0"><form method="POST" action="#" id="form2">
<p class="left" align="left"><font color="#FF7500" size="2">Round
Awning Cover</font></p>
<p class="left" align="left" style="margin-top: 0px"><font size="2">Fabric Class:</font><font size="1">
<select size="1" name="select1">
<option selected value="K">K</option>
<option value="P">P</option>
<option value="P+10">P+10</option>
<option value="P+15">P+15</option>
<option value="P+25">P+25</option>
<option value="P+80">P+80</option></select></font></p>
<p class="left" align="left" style="margin-top: 0px"><font size="2">Combined Drop & Projection:
</font><font size="1"><select size="1" name="select2">
<option value="3-0" selected>3-0</option>
<option value="4-0">4-0</option>
<option value="5-0">5-0</option>
<option value="6-0">6-0</option>
<option value="7-0">7-0</option>
<option value="8-0">8-0</option>
<option value="9-0">9-0</option>
<option value="10-0">10-0</option>
<option value="11-0">11-0</option>
<option value="12-0">12-0</option></select></font><font size="2">
Width:</font><font size="1"> <select size="1" name="select3">
<option value="3-0" selected>3-0</option>
<option value="4-0">4-0</option>
<option value="5-0">5-0</option>
<option value="6-0">6-0</option>
<option value="7-0">7-0</option>
<option value="8-0">8-0</option>
<option value="9-0">9-0</option>
<option value="10-0">10-0</option>
<option value="11-0">11-0</option>
<option value="12-0">12-0</option>
<option value="13-0">13-0</option>
<option value="14-0">14-0</option>
<option value="15-0">15-0</option>
<option value="16-0">16-0</option>
<option value="17-0">17-0</option>
<option value="18-0">18-0</option>
<option value="19-0">19-0</option>
<option value="20-0">20-0</option>
<option value="21-0">21-0</option>
<option value="22-0">22-0</option>
<option value="23-0">23-0</option>
<option value="24-0">24-0</option>
<option value="25-0">25-0</option>
<option value="26-0">26-0</option>
<option value="27-0">27-0</option>
<option value="28-0">28-0</option>
<option value="29-0">29-0</option>
<option value="30-0">30-0</option></select></font></p>
<p class="left" align="left" style="margin-top: 0px"> </p>
<p class="left" align="center" style="margin-top: 0px"><font size="2">
<button type="submit" style="width: 92px; height: 22px"><font size="1">Get Dealer Cost</font>
</button></font> <input type="text" name="price" value="" readonly="readonly" size="5"></font>
<script type="text/javascript">
<!--
function cost() {
var price=[];
price[0]=[
[93, 106, 117, 127, 136, 144, 161, 173, 200, 239],
[106, 117, 130, 139, 144, 161, 173, 200, 215, 263],
[117, 130, 141, 147, 161, 173, 207, 222, 246, 278],
[356, 399, 413, 491, 504, 525, 599, 628, 673, 702]
];
price[1]=[
[109, 118, 133, 142, 151, 161, 179, 196, 228, 269],
[118, 133, 142, 151, 161, 179, 196, 228, 246, 297],
[415, 449, 482, 516, 557, 597, 638, 674, 710, 744]
];
price[2]=[
[121, 131, 147, 157, 167, 179, 199, 219, 255, 390],
[131, 147, 157, 167, 179, 199, 219, 253, 276, 428],
[460, 497, 534, 572, 617, 661, 705, 745, 784, 1204]
];
price[3]=[
[127, 138, 154, 165, 175, 188, 208, 230, 268, 396],
[138, 154, 165, 175, 188, 208, 230, 265, 291, 435],
[482, 521, 559, 600, 647, 693, 739, 781, 822, 1226]
];
price[4]=[
[139, 151, 169, 180, 191, 206, 228, 253, 295, 408],
[151, 169, 180, 191, 206, 228, 253, 290, 320, 448],
[527, 570, 611, 655, 706, 757, 807, 852, 896, 1271]
];
price[5]=[
[203, 224, 247, 263, 280, 304, 336, 378, 443, 472],
[224, 247, 263, 280, 304, 336, 378, 425, 484, 521],
[774, 835, 895, 962, 1035, 1107, 1177, 1242, 1305, 1518]
];
var f=document.getElementById('form2');
f['price'].value='$'+price[f['select1'].selectedIndex][f['select3'].selectedIndex][f['select2'].selectedIndex];
return false;}
if(document.getElementById) {
window.onload=function() {
document.getElementById('form2').onsubmit=cost;
document.getElementsByName('price')[0].type='text';
document.getElementsByName('price')[0].onfocus=function() {this.blur();};
};
}
//-->
</script>
</body>
</html>
Please, read this thread while I try to trawl through that code.
edit , not sure but I'm guessing it's got something to do with giving your select elements the same names, and maybe some other copy+paste related issues. Incedently, why have you doubled up the function? It looks about the same to me.
Last edited by the tree; 03-01-2006 at 05:04 PM .
Disclaimer. (1) Whilst I will help you sometimes, if I feel like it, and my advice in relation to your actual question will be of good quality: my posts are to be taken with a pinch of salt. I will be sarcastic, deploy irony and include obscure cultural references for my own amusement without warning.
(2) You will gain nothing from complaining, and if you try to argue with me then you will not win. No matter how noble your battle seems, I am still better than you, don't be an hero.
Help Please
Thank you for looking at my code. The figures will be different for the two types but I just copied them to show what it was that I was trying to accomplish.
Thank for the link to the thread. Should I repost my request?
No. Some javascript-type will find it soon enough.
Disclaimer. (1) Whilst I will help you sometimes, if I feel like it, and my advice in relation to your actual question will be of good quality: my posts are to be taken with a pinch of salt. I will be sarcastic, deploy irony and include obscure cultural references for my own amusement without warning.
(2) You will gain nothing from complaining, and if you try to argue with me then you will not win. No matter how noble your battle seems, I am still better than you, don't be an hero.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
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
Bookmarks