Compare string and alert in dialog : If : Language Basics JAVASCRIPT DHTML TUTORIALS


JAVASCRIPT DHTML TUTORIALS » Language Basics » If »

 

Compare string and alert in dialog



<HTML>
<HEAD>
<SCRIPT language="JavaScript">
<!-- 
var thesport="Golf";
var myfood="Pizza";

if(thesport=="Football"){
    window.alert("Cool Sport!");
}else{
    window.alert("That sport might be cool.");
}

if(myfood=="Pizza"){
    window.alert("My favorite food!");
}else{
    window.alert("That food sounds OK I guess.");
}

//-->
</SCRIPT>

</HEAD>

<BODY>


</BODY>

</HTML>

           
       



-

Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

JAVASCRIPT DHTML TUTORIALS

 Navioo Language Basics
» If