I'm trying to create an if...else if...else argument where the only variable is the current Access Level number. This will determine what content to display to the user, so that someone with level 1 will see one thing while someone with level 0 will see another.
By default everything is hidden, but once someone goes to the web page the Javascript is supposed to change the ID of the element to show the appropriate content. I'm not quite sure what I'm doing wrong but it's not changing the ID as it should. If I'm going about this the wrong way please let me know what other alternatives there may be.
<html>
<body>
<style type="text/css">
#AccessLevel1Hide {display: none; }
#AccessLevel1Show {display: block; }
#AccessLevel0Hide {display: none; }
#AccessLevel0Show {display: block; }
</style>
<script type="text/javascript">
var AccessLevel = (1);
if (AccessLevel == 1){
document.getElementById('AccessLevel1Hide').id="AccessLevel1Show";
}else if (AccessLevel == 0){
document.getElementById('AccessLevel0Hide').id="AccessLevel0Show";
}else {document.write("ERROR");
}
</script>
<div id="AccessLevel1Hide">
Access Level 1 message.
</div>
<div id="AccessLevel0Hide">
Access Level 0 message.
</div>
</body>
</html>