<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>测试window.open()/剪切板ZeroClipboard</title>
{#需要引入js、css文件#}
<script src="http://cdn.bootcss.com/jquery/1.11.1/jquery.min.js"></script>
<link href="http://cdn.bootcss.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet"/>
<script src="http://cdn.bootcss.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script type="text/javascript" src="{% static "zeroclipboard-2.2.0/dist/ZeroClipboard.js" %}"></script>
<script src="https://cdn.bootcss.com/bootbox.js/4.4.0/bootbox.min.js"></script>
</head>
<body>
<button onclick="other_web()">window.open()</button>
<a class="blue" href="#" data-action="copy" data-clipboard-text="剪切板" title="拷贝数据">ZeroClipboard</a>
</body>
</html>
<script>
/**
* window.open()
*/
function other_web() {
var left = ($(window.parent.parent).width() - 450) / 2;
window.open("http://baidu.com", "other_web", "height=650,width=450,top=0,left=" + left + ",toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no");
}
/**
* 剪切板ZeroClipboard
*/
$(function () {
var item = $('a[data-action=copy]');
var client = new ZeroClipboard(item);
client.on("ready", function (readyEvent) {
client.on("aftercopy", function (event) {
bootbox.alert("aftercopy");
});
});
})
</script>