NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page 50NP For Help

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 02-17-2006, 04:27 AM THREAD STARTER               #1 (permalink)
Senior Member
 
Xyzer's Avatar
Join Date: Aug 2005
Location: United Kindom
Posts: 1,502
Xyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to all
 


Tsunami Relief AIDS/HIV

50NP For Help


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
Xyzer is offline  
Old 02-17-2006, 04:58 AM   #2 (permalink)
Senior Member
 
Eric's Avatar
Join Date: Mar 2005
Posts: 4,948
Eric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatness
 

Member of the Month
MOTM September 2005
Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Animal Rescue Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Baby Health Cancer Alzheimer's Protect Our Planet Cancer Survivorship SIDS Child Abuse Diabetes Protect Our Planet Multiple Sclerosis Autism Adoption Special Olympics
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 by SecondVersion; 02-17-2006 at 05:00 AM. Reason: hmm, something weird goin on with [HTML][/HTML]
Eric is offline  
Old 02-17-2006, 05:18 AM THREAD STARTER               #3 (permalink)
Senior Member
 
Xyzer's Avatar
Join Date: Aug 2005
Location: United Kindom
Posts: 1,502
Xyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to all
 


Tsunami Relief AIDS/HIV
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>
Xyzer is offline  
Old 02-17-2006, 09:18 AM   #4 (permalink)
NamePros Member
Join Date: Feb 2006
Location: Chicago IL
Posts: 73
AllValley is an unknown quantity at this point
 



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?
????: NamePros.com http://www.namepros.com/programming/168409-50np-for-help.html
????: NamePros.com http://www.namepros.com/showthread.php?t=168409

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!
__________________
Hassle Free Computing and Web Solutions for Personal and Business!
Rochelle Network Communications!
Last edited by AllValley; 02-17-2006 at 09:27 AM.
AllValley is offline  
Old 02-18-2006, 11:35 AM THREAD STARTER               #5 (permalink)
Senior Member
 
Xyzer's Avatar
Join Date: Aug 2005
Location: United Kindom
Posts: 1,502
Xyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to all
 


Tsunami Relief AIDS/HIV
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?
Xyzer is offline  
Old 02-19-2006, 10:36 AM   #6 (permalink)
NamePros Member
Join Date: Feb 2006
Location: Chicago IL
Posts: 73
AllValley is an unknown quantity at this point
 



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
__________________
Hassle Free Computing and Web Solutions for Personal and Business!
Rochelle Network Communications!
AllValley is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 09:41 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger