Previous Example-|-Next Example-|-Return to Chapter Listing

Example 5.10:
The Logical Operators--And


Click these buttons to see the value in the bCheck variables, the results of using the And operator in different situations:





This is the script we used. First we placed this in the HEAD: <SCRIPT LANGUAGE="JAVASCRIPT"> <!-- var bFirstValue = true var bSecondValue = false var bThirdValue = true var bFourthValue = false var bCheck1 = bFirstValue && bSecondValue var bCheck2 = bFirstValue || bThirdValue var bCheck3 = bSecondValue || bFourthValue //--> </SCRIPT> Then we created these buttons: <form> <input type="button" name="VariableButton" value="true + false" onclick="alert(bCheck1)"><br> <input type="button" name="VariableButton" value="true + true" onclick="alert(bCheck2)"><br> <input type="button" name="VariableButton" value="false + false" onclick="alert(bCheck3)"><br> </form>
Previous Example-|-Next Example-|-Return to Chapter Listing