我正在使用jQuery在新窗口中打开一个链接:
<script type="text/javascript">
$(document).ready(function() {
$('a[href="/education/global-health-courses"]').attr("target", "_blank");
});
</script>
Run Code Online (Sandbox Code Playgroud)
我想将新窗口的大小设置为800px宽,700px高.我只需要帮助将这些属性添加到现有代码中.
谢谢.
Yur*_*ich 12
您无法使用该target="_blank"方法设置这些属性,您必须使用window.open方法:
$(document).ready(function() {
$('a[href="/education/global-health-courses"]').click(function() {
window.open($(this).attr('href'),'title', 'width=800, height=700');
return false;
});
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12706 次 |
| 最近记录: |