Closing popup window after 3 seconds

前端 未结 8 1477
孤独总比滥情好
孤独总比滥情好 2020-12-03 18:02

I need to close the popup windows in the following after 3 seconds. How do I do it.


                  

        
相关标签:
8条回答
  • 2020-12-03 18:48

    Try

    <area alt="" coords="127, 22, 20" alt="" title="click here" href="includes/popup1.htm" onclick="openWindow()" shape="circle" />
    
    function openWindow(){
        var win = window.open('includes/popup1.htm', '1366002941508',  'width=500,height=200,left=375,top=330');
        setTimeout(function(){
            win.close()
        }, 3000);
        return false;
    }
    
    0 讨论(0)
  • 2020-12-03 18:51
    <area alt="" coords="127, 22, 20" alt="" title="click here" href="includes/popup1.htm" onclick="openWindow()" shape="circle" />
    
    function openWindow(){
        var win = window.open('includes/popup1.htm', '1366002941508',  'width=500,height=200,left=375,top=330');
        setTimeout(function(){
            win.close()
        }, 3000);
        return false;
    }
    
    0 讨论(0)
提交回复
热议问题