/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Displaying Excel Spreadsheet Data in HTML

Hello All,

I am in charge of setting up a intranet web site that displays pricing information. Currently I have a table displaying the below data where the user will look across the top of the top and pick and item, and then look down the left side and pick the second item. Were the point meets is there pricing information. For exampl 4′ 0″ across the top and 3′ 0″ across the left side, they would see that there price is 103. Is there anyway to put this information into a drop down box and after selecting the size it will show the price in a text box?

3′ 0″ 4′ 0″ 5′ 0″
3′ 0″ 90 103 114
4′ 0″ 103 114 126

Any help would be greatly appericated.

to post a comment
HTML

23 Comments(s)

Copy linkTweet thisAlerts:
@FangOct 04.2005 — <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>price</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<script type="text/javascript">
<!--
function cost() {
var price=[
[90, 103, 114],
[103, 114, 126]
];
var f=document.getElementById('form1');
f['price'].value='$ '+price[f['select2'].selectedIndex][f['select1'].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>

<style type="text/css">
<!--

-->
</style>

</head>
<body>
<form action="#" id="form1">
<fieldset><legend>Price</legend>
<label>length:<select name="select1">
<option value="3">3' 0"</option>
<option value="4">4' 0"</option>
<option value="5">5' 0"</option>
</select>
</label>
<label>width:<select name="select2">
<option value="3">3' 0"</option>
<option value="4">4' 0"</option>
</select>
</label>
<input type="hidden" name="price" value="0">
<button type="submit">submit</button>
</fieldset>
</form>
</body>
</html>
Copy linkTweet thisAlerts:
@Randy_The_NewbeauthorOct 04.2005 — Thank You. Were does the result show up?
Copy linkTweet thisAlerts:
@FangOct 04.2005 — In the [I]input [/I]'price'
Copy linkTweet thisAlerts:
@Randy_The_NewbeauthorOct 05.2005 — I'm sorry I am really new at all of this but I don't follow what you mean. When I run your script I get no pricing information displayed.
Copy linkTweet thisAlerts:
@KravvitzOct 05.2005 — You should be able to see it if you change
<input type="hidden" name="price" value="0">
to
<input type="text" name="price" value="" readonly="readonly">
Copy linkTweet thisAlerts:
@Randy_The_NewbeauthorOct 05.2005 — Thank you. Works great. Appericate all the help.
Copy linkTweet thisAlerts:
@Randy_The_NewbeauthorOct 05.2005 — I thought I had it working, however, when I select a width great than 12, I get a $user definded error. Any ideal what I am doing wrong?

Thanks in advance for any assistance.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"

"http://www.w3.org/TR/html4/strict.dtd">

<html lang="en">

<head>

<title>price</title>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<script type="text/javascript">

<!--

function cost() {

var price=[

[90, 103, 114, 123, 132, 140, 156, 168, 194, 232],

[103, 114, 126, 135, 140, 156, 168, 194, 209, 255],

[114, 126, 137, 143, 156, 168, 201, 216, 239, 270],

[126, 137, 145, 151, 174, 187, 216, 246, 255, 278],

[137, 145, 155, 168, 187, 216, 232, 263, 270, 293],

[145, 155, 168, 185, 201, 232, 246, 278, 285, 319],

[155, 168, 181, 198, 216, 246, 263, 285, 293, 333],

[162, 175, 188, 213, 246, 263, 278, 293, 307, 359],

[175, 188, 202, 228, 255, 270, 285, 307, 319, 373],

[188, 202, 217, 244, 263, 278, 293, 319, 333, 385],

[195, 209, 225, 251, 270, 285, 319, 333, 345, 399],

[202, 217, 233, 261, 278, 293, 333, 345, 373, 412],

[209, 225, 241, 275, 285, 307, 345, 359, 385, 426],

[225, 233, 248, 283, 293, 319, 359, 373, 412, 439],

[233, 248, 256, 291, 307, 333, 373, 399, 426, 453],

[241, 256, 273, 299, 319, 345, 385, 412, 439, 468],

[256, 267, 280, 313, 333, 359, 399, 426, 453, 482],

[266, 280, 289, 339, 345, 373, 412, 453, 468, 496],

[273, 289, 297, 352, 373, 385, 426, 468, 482, 525],

[280, 297, 304, 367, 385, 399, 439, 482, 496, 539],

[289, 304, 319, 380, 399, 412, 453, 496, 510, 553],

[297, 319, 332, 392, 412, 426, 468, 510, 525, 569],

[304, 332, 346, 407, 426, 439, 482, 525, 539, 596],

[319, 346, 358, 420, 439, 453, 525, 539, 569, 610],

[325, 358, 374, 435, 451, 568, 539, 553, 596, 633],

[332, 374, 387, 448, 465, 482, 553, 582, 610, 653],

[340, 381, 394, 462, 477, 496, 569, 596, 625, 667],

[346, 387, 401, 477, 489, 510, 582, 610, 653, 682]

];

var f=document.getElementById('form1');

f['price'].value='$ '+price[f['select2'].selectedIndex][f['select1'].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>

<style type="text/css">

<!--

-->

</style>

</head>

<body>

<form action="#" id="form1">

<fieldset><legend>Price</legend>

<label>Width:<select name="select1">

<option value="3">3&#39; 0&quot;</option>

<option value="4">4&#39; 0&quot;</option>

<option value="5">5&#39; 0&quot;</option>

<option value="6">6&#39; 0&quot;</option>

<option value="7">7&#39; 0&quot;</option>

<option value="8">8&#39; 0&quot;</option>

<option value="9">9&#39; 0&quot;</option>

<option value="10">10&#39; 0&quot;</option>

<option value="11">11&#39; 0&quot;</option>

<option value="12">12&#39; 0&quot;</option>

<option value="13">13&#39; 0&quot;</option>

<option value="14">14&#39; 0&quot;</option>

<option value="15">15&#39; 0&quot;</option>

<option value="16">16&#39; 0&quot;</option>

<option value="17">17&#39; 0&quot;</option>

<option value="18">18&#39; 0&quot;</option>

<option value="19">19&#39; 0&quot;</option>

<option value="20">20&#39; 0&quot;</option>

<option value="21">21&#39; 0&quot;</option>

<option value="22">22&#39; 0&quot;</option>

<option value="23">23&#39; 0&quot;</option>

<option value="24">24&#39; 0&quot;</option>

<option value="25">25&#39; 0&quot;</option>

<option value="26">26&#39; 0&quot;</option>

<option value="27">27&#39; 0&quot;</option>

<option value="28">28&#39; 0&quot;</option>

<option value="29">29&#39; 0&quot;</option>

<option value="30">30&#39; 0&quot;</option>

</select>

</label>

<label>Combined Drop and Projection:<select name="select2">

<option value="3">3&#39; 0&quot;</option>

<option value="4">4&#39; 0&quot;</option>

<option value="5">5&#39; 0&quot;</option>

<option value="6">6&#39; 0&quot;</option>

<option value="7">7&#39; 0&quot;</option>

<option value="8">8&#39; 0&quot;</option>

<option value="9">9&#39; 0&quot;</option>

<option value="10">10&#39; 0&quot;</option>

<option value="11">11&#39; 0&quot;</option>

<option value="12">12&#39; 0&quot;</option>

</select>

</label>

<input type="text" name="price" value="" readonly="readonly">

<button type="submit">submit</button>

</fieldset>

</form>

</body>

</html>
Copy linkTweet thisAlerts:
@Randy_The_NewbeauthorOct 05.2005 — $ undefined not $user definded
Copy linkTweet thisAlerts:
@FangOct 05.2005 — Swap the select names:f['price'].value='$ '+price[f['select[COLOR=Green]1[/COLOR]'].selectedIndex][f['select[COLOR=Green]2[/COLOR]'].selectedIndex];
Copy linkTweet thisAlerts:
@Randy_The_NewbeauthorOct 06.2005 — Fang,

Thanks for the help. I have learned a great deal in a short period of time. Can you recommended a good book to learn more about javascript?
Copy linkTweet thisAlerts:
@Randy_The_NewbeauthorOct 06.2005 — I would like to take the time to thank Fang for the help with this code. I was asked if there was any way to put a class 1 and class 2 selection before the combined drop and projection selection that would when chosen would select one of two different pricing scemes. At the "var price=[" and then the data behind it would be listed twice. Two different pricing scemes. Is this possible and if so can you help me in getting it started?

Again, thank you for the help it getting this working.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"

"http://www.w3.org/TR/html4/strict.dtd">

<html lang="en">

<head>

<title>price</title>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<script type="text/javascript">

<!--

function cost() {

var price=[

[90, 103, 114, 123, 132, 140, 156, 168, 194, 232],

[103, 114, 126, 135, 140, 156, 168, 194, 209, 255],

[114, 126, 137, 143, 156, 168, 201, 216, 239, 270],

[126, 137, 145, 151, 174, 187, 216, 246, 255, 278],

[137, 145, 155, 168, 187, 216, 232, 263, 270, 293],

[145, 155, 168, 185, 201, 232, 246, 278, 285, 319],

[155, 168, 181, 198, 216, 246, 263, 285, 293, 333],

[162, 175, 188, 213, 246, 263, 278, 293, 307, 359],

[175, 188, 202, 228, 255, 270, 285, 307, 319, 373],

[188, 202, 217, 244, 263, 278, 293, 319, 333, 385],

[195, 209, 225, 251, 270, 285, 319, 333, 345, 399],

[202, 217, 233, 261, 278, 293, 333, 345, 373, 412],

[209, 225, 241, 275, 285, 307, 345, 359, 385, 426],

[225, 233, 248, 283, 293, 319, 359, 373, 412, 439],

[233, 248, 256, 291, 307, 333, 373, 399, 426, 453],

[241, 256, 273, 299, 319, 345, 385, 412, 439, 468],

[256, 267, 280, 313, 333, 359, 399, 426, 453, 482],

[266, 280, 289, 339, 345, 373, 412, 453, 468, 496],

[273, 289, 297, 352, 373, 385, 426, 468, 482, 525],

[280, 297, 304, 367, 385, 399, 439, 482, 496, 539],

[289, 304, 319, 380, 399, 412, 453, 496, 510, 553],

[297, 319, 332, 392, 412, 426, 468, 510, 525, 569],

[304, 332, 346, 407, 426, 439, 482, 525, 539, 596],

[319, 346, 358, 420, 439, 453, 525, 539, 569, 610],

[325, 358, 374, 435, 451, 568, 539, 553, 596, 633],

[332, 374, 387, 448, 465, 482, 553, 582, 610, 653],

[340, 381, 394, 462, 477, 496, 569, 596, 625, 667],

[346, 387, 401, 477, 489, 510, 582, 610, 653, 682]

];

var f=document.getElementById('form1');

f['price'].value='$'+price[f['select1'].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>

<style type="text/css">

<!--

-->

</style>

</head>

<body>

<form action="#" id="form1">

<fieldset><legend>Price</legend>

</label>

<label>Combined Drop and Projection: <select name="select2">

<option value="3">3&#39; 0&quot;</option>

<option value="4">4&#39; 0&quot;</option>

<option value="5">5&#39; 0&quot;</option>

<option value="6">6&#39; 0&quot;</option>

<option value="7">7&#39; 0&quot;</option>

<option value="8">8&#39; 0&quot;</option>

<option value="9">9&#39; 0&quot;</option>

<option value="10">10&#39; 0&quot;</option>

<option value="11">11&#39; 0&quot;</option>

<option value="12">12&#39; 0&quot;</option>

</select>

</label>

<label>Width: <select name="select1">

<option value="3">3&#39; 0&quot;</option>

<option value="4">4&#39; 0&quot;</option>

<option value="5">5&#39; 0&quot;</option>

<option value="6">6&#39; 0&quot;</option>

<option value="7">7&#39; 0&quot;</option>

<option value="8">8&#39; 0&quot;</option>

<option value="9">9&#39; 0&quot;</option>

<option value="10">10&#39; 0&quot;</option>

<option value="11">11&#39; 0&quot;</option>

<option value="12">12&#39; 0&quot;</option>

<option value="13">13&#39; 0&quot;</option>

<option value="14">14&#39; 0&quot;</option>

<option value="15">15&#39; 0&quot;</option>

<option value="16">16&#39; 0&quot;</option>

<option value="17">17&#39; 0&quot;</option>

<option value="18">18&#39; 0&quot;</option>

<option value="19">19&#39; 0&quot;</option>

<option value="20">20&#39; 0&quot;</option>

<option value="21">21&#39; 0&quot;</option>

<option value="22">22&#39; 0&quot;</option>

<option value="23">23&#39; 0&quot;</option>

<option value="24">24&#39; 0&quot;</option>

<option value="25">25&#39; 0&quot;</option>

<option value="26">26&#39; 0&quot;</option>

<option value="27">27&#39; 0&quot;</option>

<option value="28">28&#39; 0&quot;</option>

<option value="29">29&#39; 0&quot;</option>

<option value="30">30&#39; 0&quot;</option>

</select>

<input type="text" name="price" value="" readonly="readonly">

<button type="submit">Get Price</button>

</fieldset>

</form>

</body>

</html>
Copy linkTweet thisAlerts:
@FangOct 06.2005 — I've change a lot, read through it carefully:<i>
</i>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
&lt;title&gt;price&lt;/title&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;

&lt;script type="text/javascript"&gt;
&lt;!--
function cost() {
var price=[];
price[0]=[
[70, 83, 94],
[83, 94, 106]
];
price[1]=[
[90, 103, 114],
[103, 114, 126]
];
var f=document.getElementById('form1');
var quality=(f['quality'][0].checked)? 0 : 1;
f['price'].value='$ '+price[quality][f['select1'].selectedIndex][f['select2'].selectedIndex];
return false;}

if(document.getElementById) {
window.onload=function() {
document.getElementById('form1').onsubmit=cost;
document.getElementsByName('price')[0].className='expanded';
document.getElementsByName('price')[0].onfocus=function() {this.blur();};
};
}
//--&gt;
&lt;/script&gt;

&lt;style type="text/css"&gt;
&lt;!--
.expanded {display:block;}
.collapsed {display:none;}

label {display:block;}
--&gt;
&lt;/style&gt;

&lt;/head&gt;
&lt;body&gt;
&lt;form action="#" id="form1"&gt;
&lt;fieldset&gt;&lt;legend&gt;Price&lt;/legend&gt;
&lt;label&gt;Class 1&lt;input type="radio" name="quality" checked&gt;&lt;/label&gt;
&lt;label&gt;Class 2&lt;input type="radio" name="quality"&gt;&lt;/label&gt;
&lt;label&gt;Combined Drop and Projection:&lt;select name="select2"&gt;
&lt;option value="3"&gt;3' 0"&lt;/option&gt;
&lt;option value="4"&gt;4' 0"&lt;/option&gt;
&lt;option value="5"&gt;5' 0"&lt;/option&gt;
&lt;/select&gt;
&lt;/label&gt;
&lt;label&gt;Width:&lt;select name="select1"&gt;
&lt;option value="3"&gt;3' 0"&lt;/option&gt;
&lt;option value="4"&gt;4' 0"&lt;/option&gt;
&lt;/select&gt;
&lt;/label&gt;
&lt;input class="collapsed" type="text" name="price" value="0"&gt;
&lt;button type="submit"&gt;submit&lt;/button&gt;
&lt;/fieldset&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;

As for a book for learning JavaScript, I learned from others, but books by [URL=http://www.dannyg.com/]Danny Goodman[/URL] are rated highly by others.
Copy linkTweet thisAlerts:
@Randy_The_NewbeauthorOct 08.2005 — Good Evening Fang,

Could you please look this code over and see were I am making a mistake out. When you run the code you select class K and it should show you 90, class P should show you 106, class P+10 should show you 117, class P+15 should show you 122, class P+25 should show you 133, and class P+80 should show you 191. I removed allot of the code due to the length. Any help would be greatly appericated.

Thank You

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"

"http://www.w3.org/TR/html4/strict.dtd">

<html lang="en">

<head>

<title>price</title>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<script type="text/javascript">

<!--

function cost() {

var price=[];

price[0]=[

[90, 103, 114, 123, 132, 140, 156, 168, 194, 232],

[103, 114, 126, 135, 140, 156, 168, 194, 209, 255],

[346, 387, 401, 477, 489, 510, 582, 610, 653, 682]

];

price[1]=[

[106, 115, 129, 138, 147, 156, 174, 190, 221, 261],

[115, 129, 138, 147, 156, 174, 190, 221, 239, 288],

[403, 436, 468, 501, 541, 580, 619, 654, 689, 722]

];

price[2]=[

[117, 127, 142, 152, 162, 172, 191, 209, 243, 287],

[127, 142, 152, 162, 172, 191, 209, 243, 263, 317],

[443, 480, 515, 551, 595, 638, 681, 719, 758, 794]

];

price[3]=[

[122, 132, 148, 159, 169, 179, 200, 219, 254, 300],

[132, 148, 159, 169, 179, 200, 219, 254, 275, 331],

[463, 501, 538, 576, 622, 667, 712, 752, 792, 830]

];

price[4]=[

[133, 144, 161, 173, 184, 195, 218, 238, 276, 326],

[144, 161, 173, 184, 195, 218, 238, 276, 299, 360],

[504, 545, 585, 626, 676, 725, 774, 818, 861, 903]

];

price[5]=[

[191, 207, 232, 248, 265, 281, 313, 342, 398, 470],

[207, 232, 248, 265, 281, 313, 342, 398, 430, 518],

[725, 785, 842, 902, 974, 1044, 1114, 1177, 1240, 1300]

];

var f=document.getElementById('form1');

f['price'].value='$'+price[f['select2'].selectedIndex][f['select3'].selectedIndex][f['select1'].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>

<style type="text/css">

<!--

-->

</style>

</head>

<body>

<form action="#" id="form1">

<fieldset><legend>Price</legend>

</label>

<label>Fabric Class: <select name="select3">

<option 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>

</label>

<label>Combined Drop and Projection: <select name="select2">

<option value="3">3&#39; 0&quot;</option>

<option value="4">4&#39; 0&quot;</option>

<option value="12">12&#39; 0&quot;</option>

</select>

</label>

<label>Width: <select name="select1">

<option value="3">3&#39; 0&quot;</option>

<option value="4">4&#39; 0&quot;</option>

<option value="30">30&#39; 0&quot;</option>

</select>

<input type="text" name="price" value="" readonly="readonly" size="8">

<button type="submit">Get Price</button>

</fieldset>

</form>

</body>

</html>
Copy linkTweet thisAlerts:
@Randy_The_NewbeauthorOct 08.2005 — Fang please disregard my last request. I was able to figure it out. So much to learn so little time to accomplish it all.

Thanks again for all of your help.

Randy
Copy linkTweet thisAlerts:
@Randy_The_NewbeauthorOct 08.2005 — <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>

<head>

</div>

<form action="#" id="form1">

&nbsp;<fieldset style="width: 719px; height: 59px"><legend><b>

<font face="Tahoma" size="2" color="#FF6600">cost1</font></b></legend>

<font face="Tahoma">

</label>

</font>

<label><font face="Tahoma">&nbsp;&nbsp;&nbsp; Class: <select name="select1">

<option 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>

Combined Drop &amp; Projection: <select name="select2">

<option value="3">3&#39; 0&quot;</option>

<option value="4">4&#39; 0&quot;</option>

<option value="12">12&#39; 0&quot;</option>
</select>

Width: <select name="select3">

<option value="3">3&#39; 0&quot;</option>

<option value="4">4&#39; 0&quot;</option>

<option value="30">30&#39; 0&quot;</option>
</select>

<input type="text" name="price" value="" readonly="readonly" size="10"></font>

<button type="submit"><font face="Tahoma" size="1">cost1</font></button>

</font>

</label>

</fieldset><p>&nbsp;</p>

&nbsp;<fieldset style="width: 719px; height: 50px"><legend><b>

<font face="Tahoma" size="2" color="#FF6600">cost2</font></b></legend>

</label>

<label><font face="Tahoma">Combined Drop and Projection:</font>

<select name="select4">

<option value="3">3&#39; 0&quot;</option>

<option value="4">4&#39; 0&quot;</option>

<option value="12">12&#39; 0&quot;</option>
</select>

<font face="Tahoma">Width: </font> <select name="select5">

<option value="3">3&#39; 0&quot;</option>

<option value="4">4&#39; 0&quot;</option>

<option value="30">30&#39; 0&quot;</option>
</select>

<input type="text" name="price1" value="" readonly="readonly" size="9">

<button type="submit"><font face="Tahoma" size="1">Cost2</font></button>

</label>

</fieldset>

<p>&nbsp;</p>

</form>

</td>

</tr>

</table>

<html lang="en">

<head>

<title>price</title>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<script type="text/javascript">

<!--

function cost() {

var price=[];

price[0]=[

[90, 103, 114, 123, 132, 140, 156, 168, 194, 232],

[103, 114, 126, 135, 140, 156, 168, 194, 209, 255],

[346, 387, 401, 477, 489, 510, 582, 610, 653, 682]

];

price[1]=[

[106, 115, 129, 138, 147, 156, 174, 190, 221, 261],

[115, 129, 138, 147, 156, 174, 190, 221, 239, 288],

[403, 436, 468, 501, 541, 580, 619, 654, 689, 722]

];

price[2]=[

[117, 127, 142, 152, 162, 172, 191, 209, 243, 287],

[127, 142, 152, 162, 172, 191, 209, 243, 263, 317],

[443, 480, 515, 551, 595, 638, 681, 719, 758, 794]

];

price[3]=[

[122, 132, 148, 159, 169, 179, 200, 219, 254, 300],

[132, 148, 159, 169, 179, 200, 219, 254, 275, 331],

[463, 501, 538, 576, 622, 667, 712, 752, 792, 830]

];

price[4]=[

[133, 144, 161, 173, 184, 195, 218, 238, 276, 326],

[144, 161, 173, 184, 195, 218, 238, 276, 299, 360],

[504, 545, 585, 626, 676, 725, 774, 818, 861, 903]

];

price[5]=[

[191, 207, 232, 248, 265, 281, 313, 342, 398, 470],

[207, 232, 248, 265, 281, 313, 342, 398, 430, 518],

[725, 785, 842, 902, 974, 1044, 1114, 1177, 1240, 1300]

];

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>

<style type="text/css">

<!--

-->

</style>

<br>

<p align="center" style="color: #FFFFFF">&nbsp;</p>

<title>price</title>

<html lang="en">

<head>

<title>price</title>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<script type="text/javascript">

<!--

function cost() {

var price=[

[71, 72, 73, 74, 75, 76, 77, 78, 81],

[72, 73, 74, 75, 76, 78, 79, 80, 83],

[240, 244, 254, 262, 266, 271, 276, 280, 287]

];

var f=document.getElementById('form1');

f['price'].value='$'+price[f['select1'].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>

<style type="text/css">

<!--

-->

</style>

</head>

<body>

<form action="#" id="form1">

&nbsp;</form>

</body>

</html></html>

I modified the code to allow two options, when I use option 2 it shows up in option 1's cost?????

Can I have this set up the way I do?????
Copy linkTweet thisAlerts:
@Randy_The_NewbeauthorOct 08.2005 — <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>

<head>

</div>

<form action="#" id="form1">

&nbsp;<fieldset style="width: 719px; height: 59px"><legend><b>

<font face="Tahoma" size="2" color="#FF6600">cost1</font></b></legend>

<font face="Tahoma">

</label>

</font>

<label><font face="Tahoma">&nbsp;&nbsp;&nbsp; Class: <select name="select1">

<option 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>

Combined Drop &amp; Projection: <select name="select2">

<option value="3">3' 0&quot;</option>

<option value="4">4' 0&quot;</option>

<option value="12">12' 0&quot;</option>
</select>

Width: <select name="select3">

<option value="3">3' 0&quot;</option>

<option value="4">4' 0&quot;</option>

<option value="30">30' 0&quot;</option>
</select>

<input type="text" name="price" value="" readonly="readonly" size="10"></font>

<button type="submit"><font face="Tahoma" size="1">cost1</font></button>

</font>

</label>

</fieldset><p>&nbsp;</p>

&nbsp;<fieldset style="width: 719px; height: 50px"><legend><b>

<font face="Tahoma" size="2" color="#FF6600">cost2</font></b></legend>

</label>

<label><font face="Tahoma">Combined Drop and Projection:</font>

<select name="select4">

<option value="3">3' 0&quot;</option>

<option value="4">4' 0&quot;</option>

<option value="12">12' 0&quot;</option>
</select>

<font face="Tahoma">Width: </font> <select name="select5">

<option value="3">3' 0&quot;</option>

<option value="4">4' 0&quot;</option>

<option value="30">30' 0&quot;</option>
</select>

<input type="text" name="price1" value="" readonly="readonly" size="9">

<button type="submit"><font face="Tahoma" size="1">Cost2</font></button>

</label>

</fieldset>

<p>&nbsp;</p>

</form>

</td>

</tr>

</table>

<html lang="en">

<head>

<title>price</title>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<script type="text/javascript">

<!--

function cost() {

var price=[];

price[0]=[

[90, 103, 114, 123, 132, 140, 156, 168, 194, 232],

[103, 114, 126, 135, 140, 156, 168, 194, 209, 255],

[346, 387, 401, 477, 489, 510, 582, 610, 653, 682]

];

price[1]=[

[106, 115, 129, 138, 147, 156, 174, 190, 221, 261],

[115, 129, 138, 147, 156, 174, 190, 221, 239, 288],

[403, 436, 468, 501, 541, 580, 619, 654, 689, 722]

];

price[2]=[

[117, 127, 142, 152, 162, 172, 191, 209, 243, 287],

[127, 142, 152, 162, 172, 191, 209, 243, 263, 317],

[443, 480, 515, 551, 595, 638, 681, 719, 758, 794]

];

price[3]=[

[122, 132, 148, 159, 169, 179, 200, 219, 254, 300],

[132, 148, 159, 169, 179, 200, 219, 254, 275, 331],

[463, 501, 538, 576, 622, 667, 712, 752, 792, 830]

];

price[4]=[

[133, 144, 161, 173, 184, 195, 218, 238, 276, 326],

[144, 161, 173, 184, 195, 218, 238, 276, 299, 360],

[504, 545, 585, 626, 676, 725, 774, 818, 861, 903]

];

price[5]=[

[191, 207, 232, 248, 265, 281, 313, 342, 398, 470],

[207, 232, 248, 265, 281, 313, 342, 398, 430, 518],

[725, 785, 842, 902, 974, 1044, 1114, 1177, 1240, 1300]

];

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>

<style type="text/css">

<!--

-->

</style>

<br>

<p align="center" style="color: #FFFFFF">&nbsp;</p>

<title>price</title>

<html lang="en">

<head>

<title>price</title>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<script type="text/javascript">

<!--

function cost() {

var price=[

[71, 72, 73, 74, 75, 76, 77, 78, 81],

[72, 73, 74, 75, 76, 78, 79, 80, 83],

[240, 244, 254, 262, 266, 271, 276, 280, 287]

];

var f=document.getElementById('form1');

f['price'].value='$'+price[f['select1'].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>

<style type="text/css">

<!--

-->

</style>

</head>

<body>

<form action="#" id="form1">

&nbsp;</form>

</body>

</html></html>

I modified the code to allow two options, when I use option 2 it shows up in option 1's cost?????

Can I have this set up the way I do?????
Copy linkTweet thisAlerts:
@FangOct 09.2005 — You can't stick two documents together, that doesn't work.

<font> is depreciated, don't use it.
&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
&lt;title&gt;price&lt;/title&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;
&lt;script type="text/javascript"&gt;
&lt;!--
function cost1() {
var price=[];
price[0]=[
[90, 103, 114, 123, 132, 140, 156, 168, 194, 232],
[103, 114, 126, 135, 140, 156, 168, 194, 209, 255],
[346, 387, 401, 477, 489, 510, 582, 610, 653, 682]
];
price[1]=[
[106, 115, 129, 138, 147, 156, 174, 190, 221, 261],
[115, 129, 138, 147, 156, 174, 190, 221, 239, 288],
[403, 436, 468, 501, 541, 580, 619, 654, 689, 722]
];
price[2]=[
[117, 127, 142, 152, 162, 172, 191, 209, 243, 287],
[127, 142, 152, 162, 172, 191, 209, 243, 263, 317],
[443, 480, 515, 551, 595, 638, 681, 719, 758, 794]
];
price[3]=[
[122, 132, 148, 159, 169, 179, 200, 219, 254, 300],
[132, 148, 159, 169, 179, 200, 219, 254, 275, 331],
[463, 501, 538, 576, 622, 667, 712, 752, 792, 830]
];
price[4]=[
[133, 144, 161, 173, 184, 195, 218, 238, 276, 326],
[144, 161, 173, 184, 195, 218, 238, 276, 299, 360],
[504, 545, 585, 626, 676, 725, 774, 818, 861, 903]
];
price[5]=[
[191, 207, 232, 248, 265, 281, 313, 342, 398, 470],
[207, 232, 248, 265, 281, 313, 342, 398, 430, 518],
[725, 785, 842, 902, 974, 1044, 1114, 1177, 1240, 1300]
];
var f=document.getElementById('form1');
f['price1'].value='$'+price[f['select1'].selectedIndex][f['select3'].selectedIndex][f['select2'].selectedIndex];
return false;}

function cost2() {
var price=[
[71, 72, 73, 74, 75, 76, 77, 78, 81],
[72, 73, 74, 75, 76, 78, 79, 80, 83],
[240, 244, 254, 262, 266, 271, 276, 280, 287]
];
var f=document.getElementById('form1');
f['price2'].value='$'+price[f['select4'].selectedIndex][f['select5'].selectedIndex];
return false;}

if(document.getElementById) {
window.onload=function() {
document.getElementById('cost1').onclick=function() {cost1();};
document.getElementById('cost2').onclick=function() {cost2();};
};
}
//--&gt;
&lt;/script&gt;
&lt;style type="text/css"&gt;
&lt;!--
body {
font-family:Tahoma, Geneva, sans-serif;
font-size:0.8em;
color:#000;
background:#fff;
}
fieldset {
width:719px;
height:50px;
min-height:50px;
}
legend {
font-weight:bold;
color:#f60;
}
form div {
margin-top:5em;
}
--&gt;
&lt;/style&gt;

&lt;/head&gt;
&lt;body&gt;

&lt;form action="#" id="form1"&gt;
&lt;fieldset&gt;&lt;legend&gt;cost1&lt;/legend&gt;
&lt;label&gt;Class:
&lt;select name="select1"&gt;
&lt;option value="K"&gt;K&lt;/option&gt;
&lt;option value="P"&gt;P&lt;/option&gt;
&lt;option value="P+10"&gt;P+10&lt;/option&gt;
&lt;option value="P+15"&gt;P+15&lt;/option&gt;
&lt;option value="P+25"&gt;P+25&lt;/option&gt;
&lt;option value="P+80"&gt;P+80&lt;/option&gt;
&lt;/select&gt;
&lt;/label&gt;
&lt;label&gt;Combined Drop &amp;amp; Projection:
&lt;select name="select2"&gt;
&lt;option value="3"&gt;3' 0&amp;quot;&lt;/option&gt;
&lt;option value="4"&gt;4' 0&amp;quot;&lt;/option&gt;
&lt;option value="12"&gt;12' 0&amp;quot;&lt;/option&gt;
&lt;/select&gt;
&lt;/label&gt;
&lt;label&gt;Width:
&lt;select name="select3"&gt;
&lt;option value="3"&gt;3' 0&amp;quot;&lt;/option&gt;
&lt;option value="4"&gt;4' 0&amp;quot;&lt;/option&gt;
&lt;option value="30"&gt;30' 0&amp;quot;&lt;/option&gt;
&lt;/select&gt;
&lt;/label&gt;
&lt;input type="text" name="price1" readonly value="" size="10"&gt;
&lt;button type="button" id="cost1"&gt;cost1&lt;/button&gt;
&lt;/fieldset&gt;

<i> </i>&lt;div&gt;
<i> </i>&lt;fieldset&gt;&lt;legend&gt;cost2&lt;/legend&gt;
<i> </i>&lt;label&gt;Combined Drop and Projection:
<i> </i> &lt;select name="select4"&gt;
<i> </i> &lt;option value="3"&gt;3' 0&amp;quot;&lt;/option&gt;
<i> </i> &lt;option value="4"&gt;4' 0&amp;quot;&lt;/option&gt;
<i> </i> &lt;option value="12"&gt;12' 0&amp;quot;&lt;/option&gt;
<i> </i> &lt;/select&gt;
<i> </i>&lt;/label&gt;
<i> </i>&lt;label&gt;Width:
<i> </i> &lt;select name="select5"&gt;
<i> </i> &lt;option value="3"&gt;3' 0&amp;quot;&lt;/option&gt;
<i> </i> &lt;option value="4"&gt;4' 0&amp;quot;&lt;/option&gt;
<i> </i> &lt;option value="30"&gt;30' 0&amp;quot;&lt;/option&gt;
<i> </i> &lt;/select&gt;
<i> </i>&lt;/label&gt;
<i> </i>&lt;input type="text" name="price2" readonly value="" size="9"&gt;
<i> </i>&lt;button type="button" id="cost2"&gt;Cost2&lt;/button&gt;
<i> </i>&lt;/fieldset&gt;
<i> </i>&lt;/div&gt;
&lt;/form&gt;

&lt;/body&gt;
&lt;/html&gt;
Copy linkTweet thisAlerts:
@Randy_The_NewbeauthorOct 09.2005 — Fang thank you for the information.
Copy linkTweet thisAlerts:
@CanisOct 10.2005 — Could you tell a complete novice what part of that code actually calls up the price and how? I figure it's this part....
[code=html]
var f=document.getElementById('form1');
f['price'].value='$'+price[f['select2'].selectedIndex][f['select3'].selectedIndex][f['select1'].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();};
[/code]

But I don't understand anything in there that would point to a specific spot in the prices he has. Reason I ask is because it could solve a problem for me too. I'm trying to convert this [URL=http://www.comfortinnvaldosta.com/wild.htm]site[/URL] which uses a popup window to display prices dependant on your selection into something similar that is being shown here. Ideally I would have liked to call the information direct from an excell sheet on the server but I believe that the server has to support PHP for that. Which it doesn't ?

Any help, suggestions would be greatly appreciated.
Copy linkTweet thisAlerts:
@FangOct 11.2005 — This line:

[COLOR=Green]f['price'].value='$'+price[f['select2'].selectedIndex][f['select3'].selectedIndex][f['select1'].selectedIndex];

[/COLOR]
which breaks down to:

[COLOR=Green]Price = Array price[Projection option][Width option][Class option][/COLOR]

where price is a multidimensional array

No PHP support! Get a provider with support, it's not expensive.

The Excel file could be imported using AJAX, but that is probably too difficult for you at the moment.

An alternative is to export the Excel file as type .csv then convert that to an array.

.csv output:

20,30,40,50

25,35,45,55

JS array:

var cost=[

[20,30,40,50],

[25,35,45,55]

];
Copy linkTweet thisAlerts:
@CanisOct 11.2005 — Thanks for the help

Unfortunately, as it's a work website, I don't have any say in what kind of provider we have ?
Copy linkTweet thisAlerts:
@CanisOct 13.2005 — You can't stick two documents together, that doesn't work.[/quote]

Does that mean I can't use the same user selections to call up several different prices. I'm trying to get this [URL=http://www.comfortinnvaldosta.com/wild.htm]site[/URL] out of using pop-ups and just display prices on the screen for all the room types depending on what the user selects. Is that possible?
Copy linkTweet thisAlerts:
@FangOct 13.2005 — Should be no problem.
×

Success!

Help @Randy_The_Newbe spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.4,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...