How do I put a link to a webpage in a JScript Alert dialog box?

前端 未结 7 1650
遥遥无期
遥遥无期 2021-01-13 22:28

I would like to put a link to a webpage in an alert dialog box so that I can give a more detailed description of how to fix the error that makes the dialog box get created.

相关标签:
7条回答
  • 2021-01-13 23:32

    You could try asking them if they wish to visit via window.prompt:

    if(window.prompt('Do you wish to visit the following website?','http://www.google.ca'))
      location.href='http://www.google.ca/';
    

    Also, Internet Explorer supports modal dialogs so you could try showing one of those:

    if (window.showModalDialog)
       window.showModalDialog("mypage.html","popup","dialogWidth:255px;dialogHeight:250px");
    else
       window.open("mypage.html","name","height=255,width=250,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,modal=yes");
    
    0 讨论(0)
提交回复
热议问题