0

我正在修改 websense 块页面以包含一些基于变量的函数:$*WS_BLOCKREASON*$。我知道这个变量的潜在输出,我想要一个特定的函数。

问题是该页面甚至没有将默认情况传递给“<'div'>”内容。基本上我需要的内容是<div id="helpDiv">一整套文本,包括按钮。下面的脚本:

<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:&nbsp;&nbsp;&nbsp;&nbsp;<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>
4

2 回答 2

0

你在这条线上不正确地逃脱了:

    document.getElementById('helpDiv').innerHTML='<p style="margin-left: 10px">Help:&nbsp;&nbsp;&nbsp;&nbsp;<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>

它应该是(在 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>\

纠正了转义的小提琴:http: //jsfiddle.net/3UxCc/ 它有效。

编辑:
看起来你的$*WS变量是标记。在这种情况下,您正在分配blockReason某些东西,但除非您的 WebSense 变量包含引号(顺便说一句,它不包含引号),否则您的分配看起来像:

var blockReason = other;  

由于它周围没有引号,因此它认为这other是一个变量而不是字符串文字。您需要将其括在引号中,例如:

var blockReason = '$*WS_BLOCKREASON*$';

这会将其建立为交换机能够使用的字符串文字。其他任何东西都是会引发错误的坏变量。

于 2012-10-26T20:03:03.497 回答
0

试试这个。您正在进行一些不正确的转义...

特别是在案例的第一行中您的 onClick 部分

 case 'This Websense category is filtered: <b>Uncategorized</b>.':
    document.getElementById('helpDiv').innerHTML='<p style="margin-left: 10px">Help:&nbsp;&nbsp;&nbsp;&nbsp;<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:+18772097658>+1 877 209 7658<a/> or <a href=http://solv:8093/CAisd/pdmweb.exe?OP=JUST_GRONK_IT+HTMPL=about.htmpl target="_blank">this link.</a></p>';
break;

更新:

刚刚在 jsFiddle 中玩过之后,我得出的结论是,您对 helpDiv 的引用是无效的。

如果您用一些警报替换所有这些,您的开关将达到默认值。它快死了,因为您的 getElementById 有问题。也许该元素没有 ID helpDiv?

这是一个真正精简的版本

http://jsfiddle.net/5wvC3/

这是另一个小提琴 - 并更新最后一个,表明代码大部分工作。你的 HTML 有问题

http://jsfiddle.net/5wvC3/1/

于 2012-10-26T20:05:35.287 回答