|
![]() |
Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming > Web Coding | |
Trying to get a little computer buildin website goin
|
||
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) | ||||||||||||
|
Overclocker
|
so me and my friend are trying to build this website kinda like digital storms where people can select products and it shows the end price but we are failin, so we need some help
![]() Code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<body>
<form method="post" name="addr" id="addr" onSubmit="return false;">
<p>Select your Hard Drive</p>
<select name="hdd" id="hdd" ;>
<option value="0">120 GB</option>
<option value="1">160 GB</option>
<option value="2">320 GB</option>
<option value="3">500 GB</option>
<option value="4">1 TB</option>
<option value="5">1.5 TB</option>
</select>
</form>
<form method="post" name="calc" id="calc" onSubmit="return false;">
<p>Select your Processor.</p>
<select name="num" id="num" onChange="addr();">
<option value="0">Intel Core 2 Duo 2.93GHz </option>
<option value="1">Intel Core 2 Duo 2.93GHz +$0</option>
<option value="2">Intel Core 2 Quad 2.33GHz +$30</option>
<option value="3">Intel Core 2 Quad 2.66GHz +$20</option>
<option value="4">Intel Core 2 Quad 2.83GHz +$150</option>
</select>
</form>
<script="text/javascript">
function addr() {
var cpuprices = new Array('0.00','119.99','149.99','169.99','349.99');
var form2 = document.forms["calc"];
var cpu = form2.elements["num"];
var cpuprice = cpu.value;
var c = cpuprices[cpuprice];
document.write(x);
}
</script>
</body>
</html>
__________________
Don't worry about the world ending today; it's already tomorrow in New Zealand. Life is too short to be bound by the moral, ethical and legal constraints imposed on us by modern day society. - 003 GO BIG OR GO HOME "Wanting to be someone else is a waste of the person you are" (Kurt Cobain) "Time you enjoy wasting, is not wasted time" - John Lennon.
|
||||||||||||
|
|
|
|
|
#2 (permalink) | |||||||||||||
|
Overclocker
|
Have you thought about using an e-Commerce CMS, it could save you alot of time, after all there's no point trying re-invent the wheel.
Last edited by voltz : 09-05-09 at 01:54 PM |
|||||||||||||
|
|
|
|
|
#4 (permalink) | ||||||||||||
|
Overclocker in Training
|
Here's your code with an onchange event that updates a <div> tag with the price, btw, your original code had two objects named addr, which probably didn't load the function correctly:
__________________Code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<body>
<form method="post" name="hd" id="addr" onSubmit="return false;">
<p>Select your Hard Drive</p>
<select name="hdd" id="hdd" ;>
<option value="0">120 GB</option>
<option value="1">160 GB</option>
<option value="2">320 GB</option>
<option value="3">500 GB</option>
<option value="4">1 TB</option>
<option value="5">1.5 TB</option>
</select>
</form>
<form method="post" name="calc" id="calc" onChange=addr()>
<p>Select your Processor.</p>
<select name="num" id="num" onChange="addr();">
<option value="0">Intel Core 2 Duo 2.93GHz </option>
<option value="1">Intel Core 2 Duo 2.93GHz +$0</option>
<option value="2">Intel Core 2 Quad 2.33GHz +$30</option>
<option value="3">Intel Core 2 Quad 2.66GHz +$20</option>
<option value="4">Intel Core 2 Quad 2.83GHz +$150</option>
</select>
</form>
<div id="price">
</div>
<script type="text/javascript">
function addr() {
var cpuprices = new Array('0.00','119.99','149.99','169.99','349.99');
var form2 = document.forms["calc"];
var cpu = form2.elements["num"];
var cpuprice = cpu.value;
var c = cpuprices[cpuprice];
document.getElementById("price").innerHTML = "<p>"+c+"</p>";
}
</script>
</body>
</html>
|
||||||||||||
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|