Jump to content

Price update


hemy2000

Recommended Posts

Hi im trying to make a page where you can customise a computer and a price at the bottom auto updates when you choose different options in drop down menus. Iv got a functions.js file and the customise php file but when you choose a different option instead of adding more money on it just changes it to loads of symbols anyway heres the functions.js and the the customise page:

[!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]var glob_pp = false;
var glob_payMethods = new Array();

function updatePrice(sel)
{
var sIndex = sel.selectedIndex;
var add = parseFloat(sel.options[sIndex].getAttribute('price'));
var price = document.getElementById('price').innerHTML;
var ex = price.split('£');
price = parseFloat(ex[1]);

var cI = glob_payMethods.length;
if(glob_payMethods[cI - 1] == 'PayPal')
{
price = price / 1.032
}
var updated = price + add;
if(glob_pp)
{
updated = updated * 1.032
}
document.getElementById('price').innerHTML = '£' + updated;
}

function checkPayPal(sel)
{
var sIndex = sel.selectedIndex
var val = sel.options[sIndex].value;
var cI = glob_payMethods.length;

var p = document.getElementById('price').innerHTML;
var s = p.split('£');
s[1] = parseFloat(s[1]);

if(val == 'PayPal')
{
glob_pp = true;
if(!cI)
{
s[1] = s[1] * 1.032;
p = s[1];
}
glob_payMethods[cI] = 'PayPal';
}
else
{
glob_pp = false;
if(cI != 0 && glob_payMethods[cI - 1] == 'PayPal')
{
s[1] = s[1] / 1.032;
p = s[1];
}
glob_payMethods[cI] = 'ignore';
}
}[!--colorc--][/span][!--/colorc--]





customise:

[!--coloro:#3333FF--][span style=\"color:#3333FF\"][!--/coloro--]<?php
include "header.inc.php";
?>
<script language="javascript" type="text/javascript" src="functions.js"></script>
<style type="text/css">
<!--
.style1 {
color: #FF6600;
font-size: 18px;
}
-->
</style>


<div id="content">
<div class="title">
<h1>-Home/Office-</h1>
</div>
<div class="custom">
<h3>Cases</h3>
<img src="images/computers/cases.jpg" alt="Cases" height="200" width="740"/><br /><br />
</div>
<div class="full_">

<h3 align="center">Available Options:</h3>

<form method="post" action="order_send.php">

<table border="0" cellpadding="0" cellspacing"0" align="center">

<tr><td align="right">Case: </td><td>
<select name="case" onChange="updatePrice(this)">
<option>A-Pod Case Black - 400 watt PSU (+£26.55)</option>
<option price="28">A-Pod Case White - 400 watt PSU (+£27.93)</option>
<option price="34">X-Blade Black Case - 450 watt PSU (+£33.54)</option>
<option price="35">Gladiator Case Silver/Black - 500 watt PSU (+£34.88)</option>
<option price="42">Asus TA-210 Black Case - 360 watt PSU (+£41.68)</option>
<option price="53">CoolerMaster Centurion 534 - 450 watt PSU (+£52.58)</option>
<option price="56">CoolerMaster Cavalier 3 - 450 watt PSU (+£55.69)</option>
<option price="81">Chieftec Mesh LCX-01 Blue - 410 watt PSU (+£80.87)</option>
<option price="98">Lian Li PC-6289 - 450 watt PSU (+£97.38)</option>
</select>
</td></tr>

<tr><td align="right">Power Supply: </td><td>
<select name="power_supply">
<option>300w truepower PSU (+£9.39)</option>
</select>
</td></tr>

<tr><td align="right">Motherboard: </td><td>
<select name="motherboard">
<option>Gigabyte GA-K8N51GMF nForce410 (+£39.80)</option>
</select>
</td></tr>

<tr><td align="right">Processor: </td><td>
<select name="processor" onchange="updatePrice(this)">
<option>2800+ AMD Sempron 64-bit - (Select Socket 754 motherboard) (+£51.00)</option>
<option price="87">3000+ AMD Athlon 64-bit - (Select Socket 754 motherboard) (+£86.98)</option>
<option price="128">3500+ AMD Athlon 64-bit - (Select Socket 939 motherboard) (+£127.89)</option>
<option price="218">3800+ AMD Athlon 64 X2 (Dual) - (Select Socket 939 motherboard) (+£217.77)</option>
<option price="468">4800+ AMD Athlon 64 X2 (Dual) - (Select Socket 939 motherboard) (+£467.38)</option>
</select>
</td></tr>

<tr><td align="right">Graphics: </td><td>
<select name="graphics" onchange="updatePrice(this)">
<option>Onboard Graphics - (Select `with Onboard Graphics' in Mainboard option list)</option>
<option price="22">AGP - 64MB Inno3D MX4000 - (Not for AMD Socket 939 cpu's) (+£21.87)</option>
<option price="35">PCI-E - 256MB Inno3D 6200 TurboCache (+£34.58)</option>
<option price="65">PCI-E - 256MB Sparkle GeForce 6600 (+£64.55)</option>
<option price="102">PCI-E - 256MB XFX GeForce 7600GS XT (+£101.97)</option>
<option price="133">PCI-E - 256MB Inno3D GeForce 7600GT (+£132.96)</option>
<option price="224">PCI-E - 256MB Sparkle GeForce 7900GT (+£223.68)</option>
<option price="287">PCI-E - 2x (SLI) 256MB Inno3D 7600GT - (Select SLI mainboard) (+£286.96)</option>
<option price="447">PCI-E - 2x (SLI) 256MB Sparkle 7900GT - (Select SLI mainboard) (+£446.36)</option>
</select>
</td></tr>

<tr><td align="right">Hard Drive 1: </td><td>
<select name="hard_drive_1" onchange="updatePrice(this)">
<option>40GB Maxtor DiamondMax IDE (+£31.86)</option>
<option price="35">80GB ExcelStor ESJ880S SATA II (+£34.72)</option>
<option price="49">160GB Maxtor SATA II (+£48.97)</option>
<option price="55">200GB Maxtor DiamondMax 10 SATA II (+£54.99)</option>
<option price="62">250GB Western Digital Caviar SE (+£61.22)</option>
<option price="78">300Gb Maxtor DiamondMax (+£77.79)</option>
<option price="122">400GB Maxtor DiamondMax 11 (+£121.97)</option>
<option price="193">500GB Western Digital Caviar SE 16 (+£192.94)</option>
</select>
</td></tr>

<tr><td align="right">Hard Drive 2: </td><td>
<select name="hard_drive_2" onchange="updatePrice(this)">
<option>Not Required</option>
<option price="32">40GB Maxtor DiamondMax IDE (+£31.86)</option>
<option price="35">80GB ExcelStor ESJ880S SATA II (+£34.72)</option>
<option price="49">160GB Maxtor SATA II (+£48.97)</option>
<option price="55">200GB Maxtor DiamondMax 10 SATA II (+£54.99)</option>
<option price="62">250GB Western Digital Caviar SE (+£61.22)</option>
<option price="78">300Gb Maxtor DiamondMax (+£77.79)</option>
<option price="122">400GB Maxtor DiamondMax 11 (+£121.97)</option>
<option price="193">500GB Western Digital Caviar SE 16 (+£192.94)</option>
</select>
</td></tr>

<tr><td align="right">Cd/Dvd Drive 1: </td><td>
<select name="optical_drive_1" onchange="updatePrice(this)">
<option>Not Required</option>
<option price="32">40GB Maxtor DiamondMax IDE (+£31.86)</option>
<option price="35">80GB ExcelStor ESJ880S SATA II (+£34.72)</option>
<option price="49">160GB Maxtor SATA II (+£48.97)</option>
<option price="55">200GB Maxtor DiamondMax 10 SATA II (+£54.99)</option>
<option price="62">250GB Western Digital Caviar SE (+£61.22)</option>
<option price="78">300Gb Maxtor DiamondMax (+£77.79)</option>
<option price="122">400GB Maxtor DiamondMax 11 (+£121.97)</option>
<option price="193">500GB Western Digital Caviar SE 16 (+£192.94)</option>
</select>
</td></tr>

<tr><td align="right">Cd/Dvd Drive 2: </td><td>
<select name="optical_drive_2" onchange="updatePrice(this)">
<option>Not Required</option>
<option price="32">40GB Maxtor DiamondMax IDE (+£31.86)</option>
<option price="35">80GB ExcelStor ESJ880S SATA II (+£34.72)</option>
<option price="49">160GB Maxtor SATA II (+£48.97)</option>
<option price="55">200GB Maxtor DiamondMax 10 SATA II (+£54.99)</option>
<option price="62">250GB Western Digital Caviar SE (+£61.22)</option>
<option price="78">300Gb Maxtor DiamondMax (+£77.79)</option>
<option price="122">400GB Maxtor DiamondMax 11 (+£121.97)</option>
<option price="193">500GB Western Digital Caviar SE 16 (+£192.94)</option>
</select>
</td></tr>

<tr><td align="right">Floppy Drive/Card Reader: </td><td>
<select name="removable_storage" onchange="updatePrice(this)">
<option>Not Required</option>
<option price="8">Floppy Disk Drive Black (+£7.48)</option>
<option price="8">Floppy Disk Drive Silver (+£7.48)</option>
</select>
</td></tr>

<tr><td align="right">Sound Card: </td><td>
<select name="sound_card" onchange="updatePrice(this)">
<option>Onboard Sound</option>
<option price="12">Genius Sound Maker 5.1 V2 (+£11.48)</option>
<option price="41">Sound Blaster Audigy 4 7.1 (+£40.12)</option>
<option price="128">Terratec Aureon 7.1 Universe (+£127.12)</option>
</select>
</td></tr>

<tr><td align="right">Keyboard: </td><td>
<select name="keyboard" onchange="updatePrice(this)">
<option>Not Required</option>
<option price="32">40GB Maxtor DiamondMax IDE (+£31.86)</option>
<option price="35">80GB ExcelStor ESJ880S SATA II (+£34.72)</option>
</select>
</td></tr>

<tr><td align="right">Mouse: </td><td>
<select name="mouse" onchange="updatePrice(this)">
<option>Not Required</option>
<option price="32">40GB Maxtor DiamondMax IDE (+£31.86)</option>
<option price="35">80GB ExcelStor ESJ880S SATA II (+£34.72)</option>
</select>
</td></tr>

<tr><td align="right">Speakers: </td><td>
<select name="speakers" onchange="updatePrice(this)">
<option>Not Required</option>
<option price="32">40GB Maxtor DiamondMax IDE (+£31.86)</option>
<option price="35">80GB ExcelStor ESJ880S SATA II (+£34.72)</option>
</select>
</td></tr>

<tr><td align="right">Monitor: </td><td>
<select name="monitor" onchange="updatePrice(this)">
<option>Not Required</option>
<option price="32">40GB Maxtor DiamondMax IDE (+£31.86)</option>
<option price="35">80GB ExcelStor ESJ880S SATA II (+£34.72)</option>
</select>
</td></tr>

<tr><td align="right">Operating System: </td><td>
<select name="operating_system" onchange="updatePrice(this)">
<option>Not Required</option>
<option price="57">Microsoft Windows XP Home - (Installed for free) (+£56.58)</option>
<option price="94">Microsoft Windows XP Professional - (Installed for free) (+£93.08)</option>
</select>
</td></tr>

<tr><td align="right">Building Fee: </td><td>
<select name="building_fee">
<option>Building and Testing (+£25)</option>
</select>
</td></tr>

<tr><td align="right">Parts Shipping: </td><td>
<select name="parts_shipping">
<option>Standard shipping (+£5.79)</option>
</select>
</td></tr>

<tr><td align="right">Payment Option: </td><td>
<select name="payment_option" onChange="checkPayPal(this)">
<option>Cash (Free)</option>
<option value="PayPal">Secure online charging (+3.2% total cost for PayPal fee)</option>
<option>Cheque (Free)</option>
</select>
</td></tr></table>
<br />
</div>
<div align="center">
<span class="style1" id="price">£0000</span><br /><br />
<input type="image" src="images/buttons/continue.gif" alt="Continue" name="continue"><br /><br />
</div>
</div>
<?php
include "footer.inc.php";
?>[!--colorc--][/span][!--/colorc--]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.