Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Senior Coder
    Join Date
    Aug 2002
    Location
    Kansas City, Kansas
    Posts
    1,518
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Please elaborate, we don't have much of an idea of what you need.

  • #2
    New Coder
    Join Date
    Feb 2004
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts
    TRY THIS:


    <HEAD>

    <SCRIPT LANGUAGE="JavaScript">

    <!-- Begin
    closetime = 0; // Close window after __ number of seconds?
    // 0 = do not close, anything else = number of seconds

    function Start(URL, WIDTH, HEIGHT) {
    windowprops = "left=50,top=50,width=" + WIDTH + ",height=" + HEIGHT;
    preview = window.open(URL, "preview", windowprops);
    if (closetime) setTimeout("preview.close();", closetime*1000);
    }

    function doPopup() {
    url = "http://www.yoursite.com";
    width = 100; // width of window in pixels
    height = 100; // height of window in pixels
    delay = 30; // time in seconds before popup opens
    timer = setTimeout("Start(url, width, height)", delay*1000);
    }
    // End -->
    </script>


    </HEAD>

    <BODY OnLoad="doPopup();">

  • #3
    Regular Coder trib4lmaniac's Avatar
    Join Date
    Feb 2004
    Location
    Cornwall, UK
    Posts
    535
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    If you mean make a something happen after a random number of seconds, you could write it inside a function and call it with a setTimeout()...


    <script language="JavaScript">
    <!--
    function timeout_window()
    {
    var url="http://www.mysite.com";
    var the_window="new_window";
    var extras="height=200,width=200,location=no,toolbar=no";
    window.open(url,the_window,extras);
    }
    function create_random(limit)
    {
    var the_num=Math.floor(Math.random()*limit);
    return the_num;
    }
    var random_num=create_random(11);
    setTimeout("timeout_window()",random_num*1000);
    //-->
    </script>


    Hope this helps


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •