Functional Javascript

Only available on StudyMode
  • Download(s) : 328
  • Published : June 2, 2012
Open Document
Text Preview
BONGO AIRLINES

function lowVision()
{
// the foreground background is set to black.
document.body.style.background = "black";
// the foreground color is set to white.
document.body.style.color = "white";
document.body.style.fontSize = "x-large";
document.body.style.fontFamily = "Georgia";
document.body.style.h1.background = "blue";

}

function defaultColors()
{
// the foreground background is set to black.
document.body.style.background = "white";
// the foreground color is set to white.
document.body.style.color = "black";
document.body.style.fontSize = "0.75em";
document.body.style.fontFamily = "Verdana";
document.body.style.table.background = "blue";

var t = document.getElementsByTagName("TABLE");
var size = t.length;
for (i = 0; i < size; i++)
{
t[i].style.background = "blue";
}
}

function updateCountryCode(object)//function to update international telephone No
{
if (object.value =="default")
{
document.form1.code.value ="";
}
if (object.value == "France")
{
document.form1.code.value ="++924";
}
if (object.value == "Ireland")
{
document.form1.code.value ="++353";
}
if (object.value == "England")
{
document.form1.code.value ="++666";
}
if (object.value == "USA")
{
document.form1.code.value ="++1";
}
if (object.value == "Germany")
{
document.form1.code.value ="++656";
}
}

function updatedaysrental(object)//function to update period of car rental
{
if (object.value == "default")
{
document.form1.days.value = 0;
}
if (object.value == "1day")
{
document.form1.days.value = 1;
}
if (object.value == "2days")
{
document.form1.days.value = 2;
}
if (object.value == "3days")
{
document.form1.days.value = 3;
}
if (object.value == "4days")
{
document.form1.days.value = 4;
}
if (object.value == "5days")
{
document.form1.days.value = 5;
}
if (object.value == "1week")
{
document.form1.days.value = 7;
}
if (object.value == "2weeks")
{
document.form1.days.value = 14;
}

updatecarsubtotal()
}

function updateCarType(object)//function to set the cost of the car chosen
{
if (object.value == "default")
{
document.form1.leter.value = 0;
}
if (object.value == "1.0petrol")
{
document.form1.leter.value = 50;
}
if (object.value == "1.4petrol")
{
document.form1.leter.value = 65;
}
if (object.value == "1.6diesel")
{
document.form1.leter.value = 70;
}

updatecarsubtolal()
}

function updatecarsubtotal()//function to calculate the cost of the car hire
{
litre = document.form1.leter.value * 1;
days = document.form1.days.value * 1;
subcar = litre * days;
document.form1.car_subtotal.value = subcar;
document.form1.carPrice.value=subcar;
updateFinalPrice ();
}

function OptionsSubTotal()//function to calculate the extra cost of available options
{
total = 0;
for (var i=0; i < document.form1.sport.length; i++)
{
if (document.form1.sport[i].checked)
total = total + document.form1.sport[i].value*1;
if (document.form1.text[i].checked)
total = total + document.form1.text[i].value*1;
}

document.form1.priceUpdate.value = total;
document.form1.updatePrice.value = total
updateFinalPrice ();

}

function updateCardCharge(object)//function to select witch credit cardand the cost of each
{
if (object.value=="default")
{
document.form1.cardCharge.value= 0;
}
if (object.value=="Laser")
{
document.form1.cardCharge.value= 5;
}
if (object.value=="VISA")
{
document.form1.cardCharge.value= 10;
}
if (object.value=="Master Card")
{
document.form1.cardCharge.value= 15;
}
updateFinalPrice();
}

function checkDiscount()//function calculate the discount available if...
tracking img