I’m modifying a websense block page to include a few functions based on a variable: $*WS_BLOCKREASON*$. I know the potential output of this variable, and I want to have a specific function for.
The issue is that the page is not passing even the default case to the ‘<‘div’>’ contents. Essentially I need the contents of the <div id="helpDiv"> to be a whole set of text including the button. Script below:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Access to this site is blocked</title>
<link rel="stylesheet" href="/en/Custom/master.css" type="text/css">
<script type="text/javascript" language="javascript" src="/en/Default/master.js"></script>
<script type="text/javascript" language="javascript" src="/en/Default/base64.js"></script>
<script type="text/javascript" language="javascript" src="/en/Custom/security.js"></script>
<style type="text/css">
.style1
{
width: 130px;
height: 70px;
}
</style>
</head>
<body>
<!--[if lt IE 7]> <div style="width: 725px; height: 381px;"> <![endif] -->
<img alt="BHI" class="style1"
src="/en/Custom/other.gif" /><br />
<br />
<br />
<div style="border: 1px solid #285EA6;width: 99.5%; max-width: 915px; overflow: hidden; margin-left: 1px; background-color: #EEF2F7;">
<iframe src="$*WS_BLOCKMESSAGE_PAGE*$*WS_SESSIONID*$" title="BHI_BLOCK"
name="ws_block" frameborder="0" scrolling="no"
style="width:100%; height: 200px; margin-bottom: 0px;">
</iframe>
<hr />
<!-- onload=function() possible fix -->
<script type="text/javascript">
var blockReason=$*WS_BLOCKREASON*$;
switch (blockReason)
{
case 'This Websense category is filtered: <b>Uncategorized</b>.':
document.getElementById('helpDiv').innerHTML='<p style="margin-left: 10px">Help: <INPUT TYPE="button" VALUE="Submit UNCATEGORIZED website to Websense" onClick="parent.location=\'mailto:suggest@websense.com?subject=Uncategorized Website&body=Please review and correctly categorize the website that is listed below:%0A%0A' + $*WS_URL*$ + '%0A%0AThank you.\'"></p>\
<hr />\
<p style="margin-left: 64px">Clicking on the above button will open your mail client to send an e-mail to Websense for recategorization of the above site.</p>\
<p style="margin-left: 64px">You will receive a confirmation e-mail and a case number from Websense indicating your request is proccessing.</p>\
<p style="margin-left: 64px">Please note the response time for your request will vary. Allow to three to four (3-4) hours for updates to take effect once approved.</p>\
<p style="margin-left: 64px">If you have any questions, please contact SOLV at <a href=tel:+18772222222>+1 877 2222222<a/> or <a href=http://solv:8093/CAisd/pdmweb.exe?OP=JUST_GRONK_IT+HTMPL=about.htmpl target="_blank">this link.</a></p>';
break;
case 'This Websense category is filtered: <b>Parked Domain</b>.':
document.getElementById('helpDiv').innerHTML='<p>Parked domain</p>';
break;
default:
document.getElementById('helpDiv').innerHTML='<p>No Block message help.</p>';
}
</script>
<div frameborder="0" scrolling="no" style="width:100%; height: auto; margin-bottom: 0px;" id="helpDiv">
</div>
<iframe src="$*WS_BLOCKOPTION_PAGE*$*WS_SESSIONID*$" name="ws_blockoption"
frameborder="0" scrolling="no" style="width:100%; height: auto;">
<p>To enable further options, view this page with a browser that supports iframes</p>
padding: 2px 0px;">
<div style="clear: both; overflow: hidden; height:1px;"></div>
</div>
</div>
<!--[if lt IE 7]> </div> <![endif]-->
<div id="light" class="white_content"></div>
<div id="fade" class="black_overlay"></div>
</body>
</html>
Try this instead. You have some incorrect escaping going on…
The part in particular is around your onClick in the first line of the case
UPDATE:
Having just had a play in jsFiddle I have come to the conclusion that your reference to helpDiv is invalid..
If you replace all of these with some alerts your switch will reach the default. It’s dying because there is something wrong with your getElementById. Maybe the element doesn’t have the ID helpDiv?
Here is a well and truly stripped down version
http://jsfiddle.net/5wvC3/
Here is another fiddle – and update on the last one, showing that the code mostly works. You deff have an issue with your HTML
http://jsfiddle.net/5wvC3/1/