50NP For Help

SpaceshipSpaceship
SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
Watch

Xyzer

VIP Member
Impact
12
Hi,

I will pay the person who helps me with my little coding problem 50np.

So,
The problem is i have my own build your own pc confiurator. On the upgrades page i have a little menu in which you choose the upgrade. I want to be able to have a price at the bottom of the page that says the price and when someone changes an option the price at the bottom automatically updates.

I know it wont take long but dont know how to do it.

Thanks
Steven
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Hmm, pretty sure you'd want to use onChange etc.. javascript is definitely not my strong point..but:

Code:
<html>
<head>
<script language="javascript" type="text/javascript">
<!--
function up_price()
{
  box = document.forms[0].upgrade;
  price = box.options[box.selectedIndex].value;
  if (price) document.forms[0].pri.value = price;
}
// -->
</script>
</head>

<body>

<form>
<select name="upgrade" onChange="up_price()">
<option name="upgrade1" value="9.97">upgrade1
<option name="upgrade2"value="9.98">upgrade2
<option name="upgrade3" value="9.99">upgrade3
</select>
<br><br>
<input type="text" name="pri" value="">
</form>

</body>
</html>
 
Last edited:
0
Close
Hi thanks for this code.

When i put the code into my document it isnt working for me :( would it work if it was in a seperate js file?

The code i have so far it: but it isnt working:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script language="javascript" type="text/javascript">
<!--
function up_price()
{
  box = document.forms[0].upgrade;
  price = box.options[box.selectedIndex].value;
  if (price) document.forms[0].pri.value = price;
}
// -->
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>SR COMPUTERS INTEL PACKAGES ORDER</title>

</head>
<body bgcolor="#3399FF">
<center>
<h3><u>Order Home Package</u></h3></center>
<h4>Choose any Upgrades you want:</h4>
<p>Please note if you purchase and upgrades the packages default item will not be included and replaced with the upgraded part.</p>
<form method="POST" action="thanks.php" name="Order Home Package">
<input type="TEXT" name="name" value="Enter Name">
<input type="TEXT" name="email" value="Enter Email Address">
<h5>CD Drive Upgrades:</h5>
<form method="post" action="thanks.php" name="CD Drive Upgrades">
<select name="CD Drive Upgrade" onChange="up_price() ">
<option name="No Upgrades">No Upgrades
<option name="1 X DVD-RW All Formats">1 X DVD-RW All Formats [Add £25]
<option name="2 X DVD-RW All Formats">2 X 1 X DVD-RW All Formats [Add £35]
</select>
<input type="text" name="pri" value="">
<h5>Memory Upgrades:</h5>
<form method="post" action="thanks.php" name="Memory Upgrades></form>">
<select name="Memory Upgrades">
<option value="No Upgrades">No Upgrades
<option value="2 x 512MB - 1GB Memory [Add £30]">2 x 512MB - 1GB Memory [Add £30]
<option value="2 x 1GB - 2GB Memory [Add £60]">2 x 1GB - 2GB Memory [Add £60]
<option value="Degrade Memory to 256MB [Take £15]">Degrade Memory to 256MB [Take £15]
</select>
<h5>Case Upgrades:</h5>
<form method="post" action="thanks.php" name="Case Upgrades></form>">
<select name="Case Upgrades">
<option value="No Upgrades">No Upgrades
<option value="See Through Window [Add £20]">See Through Window [Add £20]
<option value="See Through Window and Cold Cathode CCFL Lights [Add £35]">See Through Window and Cold Cathode CCFL Lights [Add £35]
</select>
<h5>Hard Disk Upgrades:</h5>
<form method="post" action="thanks.php" name="Hard Disc Upgrades></form>">
<select name="Hard Disk Upgrades">
<option value="No Extras">No Extras
<option value="120GB Hard Disk [Add £20]">120GB Hard Disk [Add £20]
<option value="160GB Hard Disk [Add £35]">160GB Hard Disk [Add £35]
</select>
<h5>Networking Upgrades:</h5>
<form method="post" action="thanks.php" name="Networking Upgrades></form>">
<select name="Networking Upgrades">
<option value="No Extras">No Extras
<option value="Gigabit Ethernet [Add £35]">Gigabit Ethernet [Add £35]
<option value="Built In Wireless [Add £35]">Built In Wireless [Add £35]
</select>
<br>

<br>
<br>
<input type="SUBMIT" name="Submit" value="Submit" src="thanks.php">
<input type="RESET" name="Reset">
</form>
</body>
</html>
 
0
Close
What does blue * yellow equal?

You're right. You can't mutliply text!


A tip:
For XHTML compliance, close all tags.
Another Tip:
You only need one form action="" per form, not per select.
another tip:
values should be numbers, names are text.

This may work, if it doesn't I'll work on it a little more.

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script language="javascript" type="text/javascript">
<!--
function up_price()
{
  box = document.forms[0].upgrade;
  price = box.options[box.selectedIndex].value;
  if (price) document.forms[0].pri.value = price;
}
// -->
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>SR COMPUTERS INTEL PACKAGES ORDER</title>

</head>
<body bgcolor="#3399FF">
<center>
<h3><u>Order Home Package</u></h3></center>
<h4>Choose any Upgrades you want:</h4>
<p>Please note if you purchase and upgrades the packages default item will not be included and replaced with the upgraded part.</p>
<form method="POST" action="thanks.php" name="Order Home Package">
<input type="TEXT" name="name" value="Enter Name" />
<input type="TEXT" name="email" value="Enter Email Address" />
<h5>CD Drive Upgrades:</h5>

<select name="CD Drive Upgrade" onChange="up_price() ">
<option selected name="No Upgrades">No Upgrades</option>
<option name="1 X DVD-RW All Formats" value="25">1 X DVD-RW All Formats [Add £25]</option>
<option name="2 X DVD-RW All Formats" value="35">2 X 1 X DVD-RW All Formats [Add £35]</option>
</select>
<input type="text" name="pri" value="" />
<h5>Memory Upgrades:</h5>

<select name="Memory Upgrades" onChange="up_price()">
<option value selected name="No Upgrades""0">No Upgrades</option>
<option name="2 x 512MB - 1GB Memory [Add £30]" value"30">2 x 512MB - 1GB Memory [Add £30]</option>
<option name="2 x 1GB - 2GB Memory [Add £60]" value"60">2 x 1GB - 2GB Memory [Add £60]</option>
<option name="Degrade Memory to 256MB [Take £15]" value"-15">Degrade Memory to 256MB [Take £15]</option>
</select>
<h5>Case Upgrades:</h5>

<select name="Case Upgrades" onChange="up_price()">
<option value selected namr="No Upgrades""0">No Upgrades</option>
<option name="See Through Window [Add £20]" value"20">See Through Window [Add £20]</option>
<option name="See Through Window and Cold Cathode CCFL Lights [Add £35]" value"35">See Through Window and Cold Cathode CCFL Lights [Add £35]</option>
</select>
<h5>Hard Disk Upgrades:</h5>

<select name="Hard Disk Upgrades" onChange="up_price()">
<option value selected name="No Extras""0">No Extras</option>
<option name="120GB Hard Disk [Add £20]" value"20">120GB Hard Disk [Add £20]</option>
<option name="160GB Hard Disk [Add £35]" value"35">160GB Hard Disk [Add £35]</option>
</select>
<h5>Networking Upgrades:</h5>
<select name="Networking Upgrades" onChange="up_price()">
<option value selected name="No Extras""0">No Extras</option>
<option name="Gigabit Ethernet [Add £35]" value"35">Gigabit Ethernet [Add £35]</option>
<option name="Built In Wireless [Add £35]" value"35">Built In Wireless [Add £35]</option>
</select>
<br>

<br>
<br>
<input type="SUBMIT" name="Submit" value="Submit" src="thanks.php">
<input type="RESET" name="Reset">
</form>
</body>
</html>

As a side note, what's the php this fees into?

Also, I think you need to create a layer or div that calls that JS. Note sure how to call JS so I wont mess with it. Maybe the other guy can help you out...

Off to Class!
 
Last edited:
0
Close
Hi,

I have got a new code off another forum and here it is:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>SR COMPUTERS INTEL PACKAGES ORDER</title>
<script>
update_price()
{
  var cost = 0;
  if (document.form1.CD Drive Upgrade.value == "No Upgrades") {then cost = cost + 0; }
  if (document.form1.CD Drive Upgrade.value == "1 X DVD-RW All Formats") {then cost = cost + 25; }
  if (document.form1.CD Drive Upgrade.value == "2 X DVD-RW All Formats") {then cost = cost + 35; }
  if (document.form2.Memory Upgrades.value == "No Upgrades") {then cost = cost + 0; }
  if (document.form2.Memory Upgrades.value == "1GB") {then cost = cost + 30; }
  if (document.form2.Memory Upgrades.value == "2GB") {then cost = cost + 60; }
  if (document.form2.Memory Upgrades.value == "256MB") {then cost = cost - 15; }
  if (document.form3.Case Upgrades.value == "No Upgrades") {then cost = cost + 0; }
  if (document.form3.Case Upgrades.value == "See Through Window [Add £20]") {then cost = cost + 20; }
  if (document.form3.Case Upgrades.value == "See Through Window and Cold Cathode CCFL Lights [Add £35]") {then cost = cost + 35; }
  if (document.form4.Hard Disk Upgrades == "No Upgrades") {then cost = cost + 0; }
  if (document.form4.Hard Disk Upgrades == "120GB Hard Disk [Add £20]") {then cost = cost + 20; }
  if (document.form4.Hard Disk Upgrades == "160GB Hard Disk [Add £35]") {then cost = cost + 35; }
  if (document.form5.Networking Upgrades.value == "No Upgrades") {then cost = cost + 0; }
  if (document.form5.Networking Upgrades.value == "Gigabit Ethernet [Add £35]") {then cost = cost + 35; }
  if (document.form5.Networking Upgrades.value == "Built In Wireless [Add £35]") {then cost = cost + 35; }
  document.form1.total.value = cost;
  document.form2.total.value = cost;
  document.form3.total.value = cost;
  document.form4.total.value = cost;
  document.form5.total.value = cost;
}
</script>
</head>
<body bgcolor="#3399FF">
<center>
<h3><u>Order Home Package</u></h3></center>
<p>The base price with no extras for this package is £470</p><br>
<p>To order a computer please fill in the form below and you will recieve and email back within 48 Hours with order conformation and order final price and a link to pay for your order.</p>
<h4>Choose any Upgrades you want:</h4>
<p>Please note if you purchase and upgrades the packages default item will not be included and replaced with the upgraded part.</p>
<form method="POST" action="thanks.php" name="Order Home Package">
<input type="TEXT" name="name" value="Enter Name">
<input type="TEXT" name="email" value="Enter Email Address">
<h5>CD Drive Upgrades:</h5>
<form method="post" action="thanks.php" name="form1"></form>
<select name="CD Drive Upgrade" onchange="update_price();">
<option value="No Upgrades">No Upgrades</option>
<option value="1 X DVD-RW All Formats">1 X DVD-RW All Formats [Add £25]</option>
<option value="2 X DVD-RW All Formats">2 X DVD-RW All Formats [Add £35]</option>
</select>
<h5>Memory Upgrades:</h5>
<form method="post" action="thanks.php" name="form2">
<select name="Memory Upgrades" onchange="update_price();">
<option value="No Upgrades">No Upgrades</option>
<option value="1GB">2 x 512MB - 1GB Memory [Add £30]</option>
<option value="2GB">2 x 1GB - 2GB Memory [Add £60]</option>
<option value="256MB">Degrade Memory to 256MB [Take £15]</option>
</select>
<h5>Case Upgrades:</h5>
<form method="post" action="thanks.php" name="form3">
<select name="Case Upgrades" onchange="update_price();">
<option value="No Upgrades">No Upgrades</option>
<option value="See Through Window [Add £20]">See Through Window [Add £20]</option>
<option value="See Through Window and Cold Cathode CCFL Lights [Add £35]">See Through Window and Cold Cathode CCFL Lights [Add £35]</option>
</select>
<h5>Hard Disk Upgrades:</h5>
<form method="post" action="thanks.php" name="form4">
<select name="Hard Disk Upgrades" onchange="update_price();">
<option value="No Upgrades">No Upgrades</option>
<option value="120GB Hard Disk [Add £20]">120GB Hard Disk [Add £20]</option>
<option value="160GB Hard Disk [Add £35]">160GB Hard Disk [Add £35]</option>
</select>
<h5>Networking Upgrades:</h5>
<form method="post" action="../Website/steve/thanks.php" name="form5">
<select name="Networking Upgrades" onchange="update_price();">
<option value="No Upgrades">No Upgrades</option>
<option value="Gigabit Ethernet [Add £35]">Gigabit Ethernet [Add £35]</option>
<option value="Built In Wireless [Add £35]">Built In Wireless [Add £35]</option>
</select>
<br>

<br>
<br>
<input type="text" name="total" </input>
<br>
<br>
<input type="SUBMIT" name="Submit" value="Submit" src="../Website/steve/thanks.php">
<input type="RESET" name="Reset">
</form>
</body>
</html>
Well the problem is that the text box at the bottom doesnt change when i select something else, could someone help please?
 
0
Close
Correct it as per the advice in my last post, and it works. But I'll leave that to you.
Cannot learn without doing :)

Also, I see no text box :s
 
0
Close
AIVikingsAIVikings

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Filters for activity feeds
Your news feed, Latest activity, and the activity tab on profiles now have filter buttons: All, Posts, Quick replies, and Other. Your...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back