MitaDC
11-13-2004, 07:36 AM
hey guys, is there any way I can get this script to work with radio buttons? Ty
function init() {
//change curr_sel to new price
curr_sel = { start_price:399 };
var sels = document.getElementsByTagName('select');
for(var i = 0; i < sels.length; i++) {
curr_sel[sels[i].name] = 0;
}
price_update();
}
function change_rel_price(list) {
var text, base;
list.options[list.selectedIndex].text.search(/\[\$(.*?)\]$/);
base = Number(RegExp.$1);
for(var i = 0; i < list.options.length; i++) {
text = list.options[i].text;
text = text.replace(/\[\$(.*?)\]$/, function(str, cost) { return '[$' + (Number(cost) - base) + ']' });
list.options[i].text = text;
}
curr_sel[list.name] += base;
price_update();
}
function price_update() {
var total = 0;
for(price in curr_sel) {
total += curr_sel[price];
}
document.getElementById('total').firstChild.nodeValue = 'Price: $' + total;
}
window.onload = init;
Page that it will be on: www.a-lantech.com/systems/budget/ALT-700.html
Thanks Guys!
function init() {
//change curr_sel to new price
curr_sel = { start_price:399 };
var sels = document.getElementsByTagName('select');
for(var i = 0; i < sels.length; i++) {
curr_sel[sels[i].name] = 0;
}
price_update();
}
function change_rel_price(list) {
var text, base;
list.options[list.selectedIndex].text.search(/\[\$(.*?)\]$/);
base = Number(RegExp.$1);
for(var i = 0; i < list.options.length; i++) {
text = list.options[i].text;
text = text.replace(/\[\$(.*?)\]$/, function(str, cost) { return '[$' + (Number(cost) - base) + ']' });
list.options[i].text = text;
}
curr_sel[list.name] += base;
price_update();
}
function price_update() {
var total = 0;
for(price in curr_sel) {
total += curr_sel[price];
}
document.getElementById('total').firstChild.nodeValue = 'Price: $' + total;
}
window.onload = init;
Page that it will be on: www.a-lantech.com/systems/budget/ALT-700.html
Thanks Guys!