Re: Multiple If statements
What does this mean? Try using the Watch Window. It's very helpful. ;)
Re: Multiple If statements
if i>0 and if i<100
watch window? you mean like the vbcode window
Re: Multiple If statements
well i ended up using c<0 or c>0 instead... it seemed to work so thx for the help anyway...
Re: Multiple If statements
if (i>s && i<s1);
Do not contain ";" behind if statement
Missing "{", so code is terminated!
Re: Multiple If statements
Quote:
Originally Posted by messup000
Hey everyone I need a little help again :( I am rewriting my calculator program and am having problems with my code...
VB Code:
function disp_prompt()
{
var i= document.getElementById("investment").value;
var r= document.getElementById("reinvest").value;
r=r - 0;
i=i - 0;
c=0+1
s=0
s1=100
s2=1000
s3=10000
q=100
q2=200
q3=300
total=0
if (i>s && i<s1);
if (c=1)<----- I cant get JS to recognize this code it just passes over it... or just doesnt do anything
{
total=i + i * q / 100
for (i=2;i<=r;i++)
total=total + total * q / 100
document.getElementById("profit").value= "$" +total 'but if i add a "+ c" it will add the number...
}
else
{
total=1000009
document.getElementById("profit").value= "$" +total
}
}
What am I doing wrong????
c=1 <-- will assign the value of 1 to c and take the left most side of the expression after assignment as the vlaue (1). Hence it will always evaluate to true.
Instead of using the assignment operator =, you should use the equality operator ==
if (c == 1)