<html>
<head>
<title>Using Binary Flags</title>
<script type="text/javascript">
var FIELD_A = 0x1; // 00001
var FIELD_B = 0x2; // 00010
var FIELD_C = 0x4; // 00100
var FIELD_D = 0x8; // 01000
var FIELD_E = 0x10; // 10000
var fieldsSet = FIELD_A | FIELD_C | FIELD_E;
if ((fieldsSet & FIELD_A) && (fieldsSet & FIELD_C)) {
document.write("Fields A and C are set");
}
</script>
</head>
</body>
</html>
|