1

asp.netのjavascriptでプロンプトで別のページにリンクする方法

他に別のページをリンクしたい

function  a()
{
    var s = prompt("hello");
    if (s != 123) {
        alert("enter number correctly");
        return true;
    }
    else
        return false;
}
4

1 に答える 1

0

window.location.hrefを使用して、else 部分で別のページを開くことができます。

function  a()
{
    var s = prompt("hello");
    if (s != 123) {
        alert("enter number correctly");
        return true;
    }
    else
        window.location.href = 'http://www.google.com'; 
}
于 2013-01-16T09:55:27.700 に答える