R
roN
Hey,
I'm having a littel trouble here. My html looks like this:
while my javascript looks like this:
[js]
var score=0; // score
var nb=0; // new business
var sb=0; // starting business
var ac=0; // available capital
var fa=0; // funds available
var ho=0; // home owner
var inc=0; // income
var im=0; //impression
var sec="";
window.onload(0,0);
function add(sec)
{
switch (sec)
{
case 'nb':// new business
nb=parseInt(document.new_business.value);
break
case 'sb':
sb=parseInt(document.00N30000000h5OE.value);
break
case 'ac':
ac=parseInt(document.00N30000000h5OG.value);
break
case 'fa':
fa=parseInt(document.funds.value);
break
case 'ho':
ho=parseInt(document.home.value);
break
case 'inc':
inc=vdocument.income.value);
break
case 'im':
im=document.excited.value;
break
}
score=nb+sb+ac+fa+ho+inc+im;
document.getElementById('postscore').value=score;
document.getElementById('cusscore').innerHTML=score;
var curdate = new Date();
var hour = curdate.getHours();
hour=hour-3; // convert hour from EST to PST
if (score >=70 && hour>=8 && hour<=16) // only between 8am and 5pm PST
{
do something
}
else
{
do something else
}
}
[/js]
Now, I get a type mismatch... it point to the function call in the html...
so i guess it doesn't like the string there but why not, what's wrong?
Shouldn't it work like that?
Any recommodations?
Thanks tons!
Ron
I'm having a littel trouble here. My html looks like this:
HTML:
<select name="new_business" id="new_business"
onchange="add('nb')">
<option value="0">Just started looking</option>
<option value="0">3 - 6 month</option>
<option value="0">6 month to one year</option>
<option value="0">1 year or more</option>
</select>
[js]
var score=0; // score
var nb=0; // new business
var sb=0; // starting business
var ac=0; // available capital
var fa=0; // funds available
var ho=0; // home owner
var inc=0; // income
var im=0; //impression
var sec="";
window.onload(0,0);
function add(sec)
{
switch (sec)
{
case 'nb':// new business
nb=parseInt(document.new_business.value);
break
case 'sb':
sb=parseInt(document.00N30000000h5OE.value);
break
case 'ac':
ac=parseInt(document.00N30000000h5OG.value);
break
case 'fa':
fa=parseInt(document.funds.value);
break
case 'ho':
ho=parseInt(document.home.value);
break
case 'inc':
inc=vdocument.income.value);
break
case 'im':
im=document.excited.value;
break
}
score=nb+sb+ac+fa+ho+inc+im;
document.getElementById('postscore').value=score;
document.getElementById('cusscore').innerHTML=score;
var curdate = new Date();
var hour = curdate.getHours();
hour=hour-3; // convert hour from EST to PST
if (score >=70 && hour>=8 && hour<=16) // only between 8am and 5pm PST
{
do something
}
else
{
do something else
}
}
[/js]
Now, I get a type mismatch... it point to the function call in the html...
so i guess it doesn't like the string there but why not, what's wrong?
Shouldn't it work like that?
Any recommodations?
Thanks tons!
Ron