0

リンクに「@」記号が含まれている場合にブラウザがメールボックスに移動しないようにする方法。

<display:column class="aligncenter" style="font-style: italic;"
                        property="conditions" sortable="true" title="Terms & Conditions"
                        autolink="true" href="javascript: openWindow('#')" paramId="pid"
                        paramProperty="pid">
                    </display:column>

function openWindow(pid) {
    pid = pid.substring(0, pid.length - 1);
    var url = "conditionpopup" + pid;
    var a = navigator.appName;
    if (a == "Netscape" || a == "Crome") {
        var w = screen.width / 2.3;
        var h = screen.height / 1.3;
        var left = (screen.width / 2) - (w / 2);
        var top = (screen.height / 2) - (h / 2);
        window.open(url, 'condtionpopup', "width=" + w + ", height=" + h
                + ", top=" + top + ", left=" + left
                + ", resizable=no, titlebar=0,dialog=yes,location=no");
    } else {
        var w = screen.width / 2.3;
        var h = screen.height / 1.5;
        var left = (screen.width / 2) - (w / 2);
        var top = (screen.height / 2) - (h / 2);
        window.open(url, 'condtionpopup', "width=" + w + ", height=" + h
                + ", top=" + top + ", left=" + left
                + ", resizable=no, titlebar=0,dialog=yes,location=no");
    }

}

データに「@」記号が含まれている場合、送信しているページにアクセスしたくないメールボックスに移動します

4

2 に答える 2

1

これを置き換えてください:

if (a == "Netscape" || a == "Crome") {
    var w = screen.width / 2.3;
    var h = screen.height / 1.3;
    var left = (screen.width / 2) - (w / 2);
    var top = (screen.height / 2) - (h / 2);
    window.open(url, 'condtionpopup', "width=" + w + ", height=" + h
            + ", top=" + top + ", left=" + left
            + ", resizable=no, titlebar=0,dialog=yes,location=no");
} else {
    var w = screen.width / 2.3;
    var h = screen.height / 1.5;
    var left = (screen.width / 2) - (w / 2);
    var top = (screen.height / 2) - (h / 2);
    window.open(url, 'condtionpopup', "width=" + w + ", height=" + h
            + ", top=" + top + ", left=" + left
            + ", resizable=no, titlebar=0,dialog=yes,location=no");
}

これとともに:

var h = screen.height / 1.5;
if (a == "Netscape" || a == "Crome") {
    var h = screen.height / 1.3;
}
var w = screen.width / 2.3;
var left = (screen.width / 2) - (w / 2);
var top = (screen.height / 2) - (h / 2);
window.open(url, 'condtionpopup', "width=" + w + ", height=" + h
        + ", top=" + top + ", left=" + left
        + ", resizable=no, titlebar=0,dialog=yes,location=no");

プログラミングで自分自身を繰り返さないでください。

今、これを使用して:

window.open('http://www.google.nl#@test', 'condtionpopup', "width=" + 500 + ", height=" + 500
        + ", top=" + 50 + ", left=" + 50
        + ", resizable=no, titlebar=0,dialog=yes,location=no");

ポップアップするのに最適なページを取得しています。メールアプリケーションはありません。メール アドレスを URL として使用すると、メール アドレスが有効な URL ではないため、アドレスが見つからないというページが表示されます。

新しいウィンドウにデータを表示したい場合は、次のようにする必要があります。

// Open a blank page
myWindow = window.open('', 'condtionpopup', "width=" + w + ", height=" + h
        + ", top=" + top + ", left=" + left
        + ", resizable=no, titlebar=0,dialog=yes,location=no");
myWindow.document.write(url);
// Write your url (or other data) to this page.
于 2013-01-17T12:06:19.117 に答える
0

表示列タグのautolink="true " を削除します.......

于 2013-02-06T14:32:28.170 に答える