有可能吗 怎么做?现在我只能在同一窗口中打开
<div style='cursor: pointer;' onclick="window.open('dailyreport', '_self');">Daily Report</div>
那只是为了在同一窗口中打开,如果我这样改变
<div style='cursor: pointer;' onclick="window.open('dailyreport', '_blank');">Daily Report</div>
在newtab中打开。
如果要在同一窗口中打开怎么办,如果需要也可以在newtab中打开?谢谢
我希望我能理解您的问题:
<script type='text/javascript'>
function Print_Report() {
if(confirm("Do you want open on a new tab?") == true) {
window.open('url.php', '_blank');
} else {
window.open('url.php', '_self');
}
}
</script>
<div style='cursor: pointer;' onclick='Print_Report();'>Daily Report</div>
编辑:
其他可能的选择是为此创建另一个div:
<script type='text/javascript'>
function Print_Report() {
window.open('url.php', '_self');
}
function Print_ReportNewTab() {
window.open('url.php', '_blank');
}
</script>
<div style='cursor: pointer;' onclick='Print_Report();'>Daily Report</div>
<div style='cursor: pointer;' onclick='Print_ReportNewTab();'>Daily Report</div>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句