按钮,启动一个url
Button in a case statement, launching a url
下面是我想要开始工作的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;
你不应该通过html在元素内部绑定事件,这会使调试javascript变得非常困难。您可以使用document创建元素。编写,然后在完成之后,可以使用DOM引用元素并以这种方式添加事件。下面是一个例子:
document.write('<button id="foo">Hai!</button>');
document.getElementById('foo').onclick = function () {
window.open('http://aceinsight.websense.com/',"_blank");
};
http://jsfiddle.net/5QxuD/我认为你的onClick调用可能是错误的。
试题:
window.open("http://aceinsight.websense.com/?url= (rest of your url)")
代替:
window.open=("http://aceinsight.websense.com/?url= (rest of your url)")
https://developer.mozilla.org/en-US/docs/DOM/window.open
相关文章:
- 一次又一次地在新的和相同的选项卡中打开一个url
- 如何使用特定的javascript函数创建一个url,以便在加载页面时运行
- 修改 HTML 的方式使左键应带到下一个 URL
- 给定一个 url,脚本如何找到加载的资源
- Javascript下载一个URL-Azure Blob存储
- 表单输入和选择值将创建一个URL
- 当数据在另一个URL上更新时,AngularJS是否可以在一个URL上触发$watch
- 将json数据发送到另一个url-在您'我从我自己的网址上得到的
- Javascript 转到 URL 如果用户输入特定数字,则转到另一个 URL
- 给定一个 URL,我如何找到锚 HTML 锚标记
- 仅当从另一个 URL 加载数据时,才会触发另一个插件
- 如何设置一个url(回调)来侦听javascript的答案
- regexp(?) 用于从另一个 URL 中提取 URL
- 使用 location.href 或类似内容打开一个 URL,后跟一个哈希符号
- 侦听 iframe 事件 - 打开一个 url
- jquery/js - 我有一堆值(字符串).我想通过 POST 将其发送到另一个 URL,我该怎么做
- 两个下拉列表表单以获取一个 URL
- 是可以用户刷新网页并同时重定向到另一个URL
- jQuery - 打开一个 URL 并选择一个值
- 您如何创建一个链接,单击该链接会将您带到一个页面,并打开一个转到另一个 URL 的新选项卡