Hi,
I am trying to convert a vbscript to Javascript. Its been a while since I've done Javascript and for the life of me cannot figure out whats wrong with this code.
Here are the questions....
1. I'm forced to put the startup function in the body section or i get an object required error.
2. Once i put the the startup function there that part works. Then i put in the buildconfig function and of course the object required is back no matter what i do. What am i missing?
Here is the code:
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<title>4117 Configurator</title>
<script language="Javascript">
Var memCost, driveCost, OSCost, warrantyCost, iTotal, sTotal, wTotal, memDigit, memDesc, driveDigit, driveDesc, OSDigit, OSDesc;
</script>
</head>
<body topmargin="0" leftmargin="0" onLoad="Javascript:setup()">
<form method="POST" action="tbd.html" name="configurator">
<script language="Javascript">
//*********** setup *********************************************
// This sub sets all the variables to thier default values
function setup()
{
window.alert("setup");
document.configurator.catNo.value = "4117T-1400-512-CDW-XP";
document.configurator.mfgNo.value = "4117-0000000002001";
memCost = 0;
driveCost = 0;
OSCost = 0;
warrantyCost = 0;
iTotal = 3995;
sTotal = iTotal + ".00";
document.configurator.lprice.value = sTotal;
memDigit = "0";
memDesc = "-512";
driveDigit = "0";
driveDesc = "-CDW";
OSDigit = "2";
OSDesc = "-XP";
document.configurator.rMem[0].checked = 1;
document.configurator.rDrive[0].checked = 1;
document.configurator.rOS[0].checked = 1;
document.configurator.rWarranty[0].checked = 1;
//Update part number
call buildConfig();
}
//************** end setup *************************************
//***** buildConfig *******************************************************************
//builds the catalog and part number corresponding to what options are selected.
function buildConfig()
{
Var Cat;
Var PN;
window.alert("buildconfig");
Cat = "4117T-1400" + memDesc + driveDesc + OSDesc;
document.configurator.catNo.value = Cat
PN = "4117-000" + memDigit + "00" + driveDigit + "00" + OSDigit + "001";
document.configurator.mfgNo.value = PN;
}
//*************************************************************************************
</script>
the text boxes mfgNo and catNo exists within the form configurator.....
I am trying to convert a vbscript to Javascript. Its been a while since I've done Javascript and for the life of me cannot figure out whats wrong with this code.
Here are the questions....
1. I'm forced to put the startup function in the body section or i get an object required error.
2. Once i put the the startup function there that part works. Then i put in the buildconfig function and of course the object required is back no matter what i do. What am i missing?
Here is the code:
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<title>4117 Configurator</title>
<script language="Javascript">
Var memCost, driveCost, OSCost, warrantyCost, iTotal, sTotal, wTotal, memDigit, memDesc, driveDigit, driveDesc, OSDigit, OSDesc;
</script>
</head>
<body topmargin="0" leftmargin="0" onLoad="Javascript:setup()">
<form method="POST" action="tbd.html" name="configurator">
<script language="Javascript">
//*********** setup *********************************************
// This sub sets all the variables to thier default values
function setup()
{
window.alert("setup");
document.configurator.catNo.value = "4117T-1400-512-CDW-XP";
document.configurator.mfgNo.value = "4117-0000000002001";
memCost = 0;
driveCost = 0;
OSCost = 0;
warrantyCost = 0;
iTotal = 3995;
sTotal = iTotal + ".00";
document.configurator.lprice.value = sTotal;
memDigit = "0";
memDesc = "-512";
driveDigit = "0";
driveDesc = "-CDW";
OSDigit = "2";
OSDesc = "-XP";
document.configurator.rMem[0].checked = 1;
document.configurator.rDrive[0].checked = 1;
document.configurator.rOS[0].checked = 1;
document.configurator.rWarranty[0].checked = 1;
//Update part number
call buildConfig();
}
//************** end setup *************************************
//***** buildConfig *******************************************************************
//builds the catalog and part number corresponding to what options are selected.
function buildConfig()
{
Var Cat;
Var PN;
window.alert("buildconfig");
Cat = "4117T-1400" + memDesc + driveDesc + OSDesc;
document.configurator.catNo.value = Cat
PN = "4117-000" + memDigit + "00" + driveDigit + "00" + OSDigit + "001";
document.configurator.mfgNo.value = PN;
}
//*************************************************************************************
</script>
the text boxes mfgNo and catNo exists within the form configurator.....