下面是我正在尝试开始工作的case语句。我已经将格式放在我想要的位置,但是此时按钮(onclick)没有任何操作。
case 'This Websense category is filtered: <b>Uncategorized</b>.':
document.write('<p><b style="margin-left: 8px;">Help:</b><INPUT TYPE="button" STYLE="margin-left: 64px;" VALUE="Submit UNCATEGORIZED website to Websense" onClick="window.open=(http://aceinsight.websense.com/?url=' +
'$*WS_URL*$,' + ' "_blank")' + '"></p>\
<hr />\
<p style="margin-left: 108px; color: #FF0000;">Clicking on the above button will open another webpage for Websense to categorize the above site. You will NOT receive a confirmation e-mail or any communication from Websense indicating your request is processing. Please note the response time for your request will vary. Allow three to four (3-4) hours for updates to take effect once approved.</p>');
break;发布于 2013-03-22 05:48:04
你不应该通过html在元素中绑定事件,这会使javascript的调试变得非常困难。可以使用document.write创建元素,然后可以使用DOM引用元素并以这种方式添加事件。下面是一个例子:
document.write('<button id="foo">Hai!</button>');
document.getElementById('foo').onclick = function () {
window.open('http://aceinsight.websense.com/',"_blank");
};http://jsfiddle.net/5QxuD/
发布于 2013-03-22 05:44:05
我想你的onClick调用可能是错误的。
尝试:
window.open("http://aceinsight.websense.com/?url= (rest of your url)")而不是:
window.open=("http://aceinsight.websense.com/?url= (rest of your url)")https://stackoverflow.com/questions/15558682
复制相似问题