I'm working on a page to put on my firewall that displays various output depending on category I'm blocking.
I've spent about the last day trying to understand why the simple javascript I'm attempting to use is not resulting in my case statements properly rendering the results I want to see.
I can't use any external CSS in this case, and forgive the crazy colors. I like to use them to tell where all my <div>
s are positioned while hacking together things like this.
Is the issue that my <script>
tags are in the wrong place?
Should I be using document.write()
somewhere instead of the .innerHTML()
method?
Perhaps I'm not understanding the DOM correctly, but any pointers here in this context would be really appreciated.
//var cat = "<category/>";
var cat = "C1"
switch (cat) {
case 'C1':
var blockReason = "R1";
break;
case 'C2':
var blockReason = "R2";
break;
case 'C3':
var blockReason = "R3";
break;
case 'C4"
var blockReason = "R4"
}
document.getElementById("blockReason").innerHTML = "<b>Block Reason: </b>"
}
html,
body {
margin: 0;
padding: 0;
}
body {
border: 0;
}
.nav {
width: 100%;
background-color: #002856;
color: white;
}
.nav h1 {
text-align: center;
margin-top: -.04em;
font-family: Helvetica, Arial, sans-serif;
}
.content-wrapper {
background-color: blue;
height: 40em;
}
.content-pane1 {
background-color: red;
height: 15em;
}
.content-pane2 {
background-color: orange;
height: 20em;
}
.footer {
background-color: #80CA9D;
height: 3.6em;
}
<div class="nav">
<h1> Website Access Has Been Blocked</h1>
</div>
<div class="content-wrapper"> Here is content-wrapper text
<div class="content-pane1">
<p>Access to the website address you were trying to visit has been blocked in accordance with policies.</p>
<p>Please call the for help on <b>*somenumber</b>, or email someaddress@example.com, and provide the following information if you believe this is in error.</p>
<p id="blockReason"><b>Block Reason: </b></p>
<p><b>Category:</b>
<category> </category>
</p>
<p><b>User\IP:</b>
<user> </user>
</p>
<p><b>Webpage:</b>
<url> </url>
</p>
</div>
<div class="content-pane2">
<p>
You can also independently submit a re-categorization request at the following vendor website:
<a href="https://www.someaddress.com/">https://www.someaddress.com/</a>
<p>
Blah blah explanation blah blah
</p>
<p>
Additionally, you can blah blah more information here.
</p>
</div>
</div>
<div class="footer"> Footer text </footer>