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 回答