View Full Version : Problem with safari
nichar
12-05-2007, 04:39 AM
I am having problems with a website. It uses javascript to choose a payment option and then calculates the price accordingly. It works on I.E and firefox, but not on safari. A few of our clients use it so it has to be sorted out urgently.
I have no idea why it wouldn't work in safari and i don't have broad enough skills for that.
Could someone please shed some light on it for me?
_Aerospace_Eng_
12-05-2007, 05:18 AM
We can't shed some light if you don't shed some code or a link.
nichar
12-05-2007, 06:53 AM
I am only a novice programmer and i have no one to help, that's why i have come here for help. Here is the code:
function getPrice(obj)
{
var allowedStr = "<?php echo $list;?>";
var shipobj = document.getElementById('shipmenttype');
if(obj.value == "South_Africa")
{
//alert(obj.value);
shipobj.innerHTML = "<select name='shippingtypes' id='shippingtypes' onChange='updatePrice(this)'><option value='0'>Choose shipment</option><option value='DHL'>2-4 days DHL</option><option value='days'>2-4 days</option></select>";
}
else if(allowedStr.indexOf(obj.value) != -1)
{
//alert(obj.value);
shipobj.innerHTML = "<select name='shippingtypes' id='shippingtypes' onChange='updatePrice(this)'><option value='0'>Choose shipment</option><option value='weeks'>2/3 Weeks</option><option value='days'>2-4 days</option></select>";
}
else
{
//alert("not in list" + allowedStr.indexOf(obj.value));
shipobj.innerHTML = "";
shipobj.innerHTML = "<select name='shippingtypes' id='shippingtypes' onChange='updatePrice(this)'><option value='0'>Choose shipment</option><option value='weeks'>2/3 Weeks</option></select>";
}
if(obj.value == 0)
shipobj.innerHTML = "Please select a country.";
updatePrice(obj);
}
function getSAPrice(obj)
{
alert("working");
}
function updatePrice(obj)
{
var objweight = document.getElementById('weight');
var objtotaldiv = document.getElementById('shiptotaldiv');
var objcountry = document.getElementById('country');
var objshiptotal = document.getElementById('finalshiptotal');
var objcarttotal = document.getElementById('carttotal');
var objgrandtotal = document.getElementById('grandtotal');
var objgrandtotaldiv = document.getElementById('grandtotaldiv');
var objshiptype = document.getElementById('shippingtype');
if(obj.value == "0")
{
objtotaldiv.innerHTML= "n/a" + " ";
objgrandtotaldiv.innerHTML = "n/a" + " ";
}
else if(objcountry.value == "South_Africa")
{
if(obj.value == "days")
{
total = objweight.value*130;
objshiptype.value="daysSA";
}
if(obj.value == "DHL")
{
dhlweight = Math.ceil(objweight.value);
total = dhlweight*50;
objshiptype.value="DHL";
}
objshiptotal.value = total.toFixed(2);
objtotaldiv.innerHTML= "R "+ total.toFixed(2) + " ";
carttot = parseInt(objcarttotal.value);
objgrandtotal.value = carttot + total;
objgrandtotaldiv.innerHTML = "R "+ (carttot + total) + " ";
}
else
{
if(obj.value == "days")
{
total = objweight.value*500;
objshiptype.value="days";
}
if(obj.value == "weeks")
{
total = objweight.value*130;
objshiptype.value="weeks";
}
objshiptotal.value = total.toFixed(2);
objtotaldiv.innerHTML= "R "+ total.toFixed(2) + " ";
carttot = parseInt(objcarttotal.value);
objgrandtotal.value = carttot + total;
objgrandtotaldiv.innerHTML = "R "+ (carttot + total) + " ";
}
}
Your help is appreciated!
nichar
12-05-2007, 08:35 AM
Hi the link is http://shop.monkeybiz.co.za. If you add an item to cart the view cart and select a country and payment otpion. (see my first post).
innerHTML is not a standard DOM method, it will not insert an element into the DOM tree. You could use DOM methods to create/append new elements.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.