|
Re: Help with website
Add a set of curly braces around the code you want in the function e.g.
Code:
var a =1;
function displayDate()
{
a=a+2;
if (a==1)
{
document.getElementById("demo").innerHTML="Hello";
}
else
{
document.getElementById("demo").innerHTML="GoodBye ";
}
}
The if statement that changes the innerHTML was not being called when you clicked the button, only the addition part
Make sense?
__________________
2013 Lake Superior Excellence In Engineering Winner
2013 Lake Superior Dean's List Finalist
2013 10,000 Lakes Engineering Inspiration Winner
2013 Championship Creativity Award Winner
Last edited by HansJ : 11-02-2012 at 22:12.
Reason: clarifying
|