1

サイド ナビゲーション バーがあり、リンクをクリックするとフォームが送信されます。forms アクションは、別のページを開きます ( target _blank)。私の問題は、この空白のページが開く前にポップアップウィンドウを開いて、ユーザーがそれを読むか、少なくとも最初にそれを見て、必要に応じて閉じるのに十分な時間開いたままにしておく必要があることです。リンクの onclick イベントでポップアップを開く関数を作成しました。次のようになります。

 <li><a href="JavaScript:document.quoteform.submit()" onclick="popUp('ag_popup.html')">Submit a Deal</a></li>

私の関数は次のようになります。

function popUp(url) 
{
leftPos = 0
topPos = 0
if (screen) {
leftPos = (screen.width / 2) - 150
topPos = (screen.height / 2) - 250
}   
newwindow=window.open(url,'name','height=300,width=500,left='+leftPos+',top='+topPos);
if (window.focus) {newwindow.focus()}
return false;}

新しい空白のページが前面に開くことなく、ポップアップを開いてフォーカスしたままにできるかどうか、誰かが知っていますか?

乾杯

4

1 に答える 1

0

You could use the setTimeout-Function to wait, hold the reference on the popup and close it then(or let the user decide!). After that submit the form from that function.

For example:

var newWindow=null;
function popUp(url) 
{
leftPos = 0
topPos = 0
if (screen) {
leftPos = (screen.width / 2) - 150
topPos = (screen.height / 2) - 250
}   
newWindow=window.open(url,'name','height=300,width=500,left='+leftPos+',top='+topPos);
if (window.focus) {newWindow.focus()}
setTimeout('closePopupAndSubmit()')', 5000);
}

function closePopupAndSubmit{
if(newWindow != null){
newWindow.close();
document.quoteform.submit();
}
}
于 2010-05-25T21:39:22.170 に答える