Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

if else statement 1

Status
Not open for further replies.

44nato44

Programmer
Dec 12, 2008
115
NL
Hi

I am not good in java script, just to let everybody know :)

But why will the below code not work ?

If I remove the else part then the code works, but if I add the else part then the whole thing does not work.. any ideas ?


function checkIfComplete(str) {
if (str=="06) Completed") {
document.getElementById('CalVal4').readOnly=false;
document.getElementById('CalVal4').className="";
var dt = new Date();
var today = (dt.getDate()<10?"0"+dt.getDate():dt.getDate())+"-";
today += (dt.getMonth()<9?"0"+(dt.getMonth()+1):(dt.getMonth()+1))+"-";
today += dt.getFullYear();
document.getElementById('CalVal4').value=today;
document.getElementById('CalVal4Fake').value=parseDateM(today);
document.getElementById('CalBtn4').style.display='inline';
}
Else {
alert(str);
}
}
 
Javascript is case sensitive, [red]E[/red]lse is different to [blue]e[/blue]lse.

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top