Rdavido
08-25-2002, 08:19 PM
HELP!!!
I need help with building a computer website to where I can have people customize and PC and it will tell their price (either in real-time or by clicking a button to update). Now I know all it takes is some java script in the head or wherever on the page, but since I am a noob at javascript, I have no clue.
If anybody could help me as in actually building a site, or just giving my tutorial url's or emails; that would be greatly appreciated.
Thanks,
Ryan
duniyadnd
08-25-2002, 11:09 PM
try the following links:
Webmonkey (http://www.webmonkey.com)
HtmlGoodies (http://www.htmlgoodies.com)
w3schools (http://www.w3schools.com)
They should give you the basics. They won't give you ready made scripts, but should guide you on some stuff.
Duniyadnd
Rdavido
08-26-2002, 12:39 AM
I know HTML, it is just that i want to define a variable and then total the value of all variables but I dont know how to do it, here is an example:
function calculateTotal() {
var Motherboard=document.Configuration(name of the form).Motherboard(name of the box).value
var total= (all vars)
}
It has an error...and I dont know the correct operators to use when trying to get the value.
Remember i am trying to get specific values of choices in drop down boxes.
joh6nn
08-26-2002, 12:58 AM
can we see the page you're working on? that would make it easier
Rdavido
08-26-2002, 01:14 AM
Sure...here is my web site
pinkotoad
08-26-2002, 01:39 AM
It is actually quite simple. Make an array for each select box.
var CPUvalue = new Array(3)
CPUvalue[0] = 75
CPUvalue[1] = 100
CPUvalue[2] = 125
varMOBvalue = new Array(3)
MOBvalue[0] = 125
MOBvalue[1] = 150
MOBvalue[0] = 135
0 corresponds to the first entry in the select box, 1 to the second, etc.
And then you would need a function not unsimilar to this:
function computeTotal(form)
CPU = CPUvalue[form.CPU.selectedIndex]
MOB = MOBvalue[form.Mainboard.selectedIndex]
total = (CPU + MOB)
form.total.value = total
<form name="form">
<select size="1" name="CPU" onChange="computeTotal(this.form)>
<option>Option 1</option>
<option>Option 2</option>
<option>Option 3</option>
</select>
<select size="1" name="Mainboard" onChange="computeTotal(this.form)>
<option>Option 1</option>
<option>Option 2</option>
<option>Option 3</option>
</select>
<input type="text" name="total" size="10">
Of course if you want to get fancy, you could always just put total in a document.write
If you have any other questions regarding this, or would like to see a full scale example, feel free to email me @ mojuba@comcast.net
Oh I almost forgot, if you want the script to total up on page load just add onload="computeTotal(this.form)" to the BODY tag.