Go to URL after OK button if alert is pressed

后端 未结 7 576
逝去的感伤
逝去的感伤 2020-12-01 17:33

I need to make sure that when the user clicks OK in a JavaScript alert window, the browser moves to a different URL. Is this possible?

7条回答
  •  Happy的楠姐
    2020-12-01 18:23

    I suspect you mean in a confirm window (ie. Yes/No options).

    if (window.confirm('Really go to another page?'))
    {
        // They clicked Yes
    }
    else
    {
        // They clicked no
    }
    

提交回复
热议问题