在每个回发页面上打开一个新选项卡

在每个回发页面上打开一个新选项卡

本文介绍了在每个回发页面上打开一个新选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

全部,



我的页面中有一个奇怪的问题。我有一个名为Print的按钮。我希望报告应该出现在新标签中,所以我在按钮的onClientClick上写了一些javascript。哪个效果很好,没有任何问题。



但是当用户再次回到原始页面时,问题就开始了,现在我在这里有几个导致回发的控件。比如说它是一个下拉列表。因此,每当用户更改下拉项时,它会导致回发,这很好,但每次在每次回发时都会打开一个新选项卡。



希望我有问题...



任何帮助??



这是一个代码:



HI all,

I have a weird problem in my page. I have a button called Print. I wanted report should come in a new tab, so i wrote some javascript on button's onClientClick. Which works great with no problem at all.

But problem starts now when user comes back on original page again, now here i have several controls which cause postback. Say for example its a dropdownlist. so whenever user changes dropdown item it causes postback which is fine but everytime it opens a new tab on every postback.

hope I am clear in question...

Any help??

Here is a code:

<asp:button ID="btnPrint" runat="server" Text = "Print" OnClick="btnPrint_Click" onClientClick="aspnetForm.target='_blank'" />

推荐答案


opener.document.getElementById('aspnetForm').target = '';





和这很有效....: - )



and this works great....:-)


<body onload="fixform()"> 





然后写一个javascript



then write a javascript

<script type="text/javascript">
    function fixform()
    {
        document.getElementById("Form1").target = '';
    }



记住你已经设置了target ='_ blank'onClientClick

for viz。:


remember you have set target ='_blank' onClientClick
for viz.:

<asp:button id="btnPrint" runat="server" text="Print" onclick="btnPrint_Click" onclientclick="Form1.target='_blank'" xmlns:asp="#unknown" />


这篇关于在每个回发页面上打开一个新选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 21:04