Jump to content

Script that makes value changes ??


rudy.siregar

Recommended Posts

Low Dear,

 

Can u help he here, i have to found the way how to make something calculator like this : http://www.psprint.com/printing_products/8x11_brochure_printing.asp and http://www.printingonline.com.au/OrderA4_booklet.php

 

So, the script can make a value of total changes everytime i click the radio and list/menu till i finish click and they show our total order. Can u help me here?

 

When i download this pages include the .js file, i really confuse where should i start to read this code. Can u give me the simple way to understand the code? And can u make a sample to make it simple? Because i'm doing project which seem like this calculator.

 

Or maybe there are downloadable script that ready to use??

 

thx for attention.

 

 

regards,

 

 

Rudy

Link to comment
Share on other sites

Here is a small script that will do something similar, you just need to fine tune it.

<script language="javascript">
var base_val = 100;

var opts = {};
opts.Memory =0;
opts.Size = 0;
opts.Warranty = 0;

function addValues(){
	var total = base_val;
	for (p in opts){
		total += opts[p];
	}

	document.getElementById('total').innerHTML = total;
}

function updateOptions(opt, value){
	opts[opt] = value;
	addValues();
}
</script>
Memory: <select onchange="if (this.value == '256 MB') updateOptions('Memory', 0); else if (this.value == '512 MB') updateOptions('Memory', 50); else updateOptions('Memory', 100);">
<option value="256 MB">256 MB</option>
    <option value="512 MB">512 MB</option>
    <option value="1024 MB">1024 MB</option>
    </select>
<br />
Memory: <select onchange="if (this.value == '50 GB') updateOptions('Size', 0); else if (this.value == '100 GB') updateOptions('Size', 50); else updateOptions('Size', 100);">
<option value="50 GB">50 GB</option>
    <option value="100 GB">100 GB</option>
    <option value="150 GB">150 GB</option>
    </select>
   
<br />
Warranty: <input type="checkbox" onclick="if (this.checked) updateOptions('Warranty', 200); else updateOptions('Warranty', 0);" />
<div id="total" style="font-weight:bold;">100</div>

Link to comment
Share on other sites

  • 4 weeks later...

Hello All,

 

I want to add some changes to my source below, and i need one input form which type is text. And the condition is when i fill numeric character in it with range 10-500, can make value changes in total. can u help me find this out?

 

thank you very much.

 

 

regards

 

rudy

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.