SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Dec 2004
    Location
    Arizona
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Coding Problem window.open

    How do I get this code to open in the existing page as opposed to a popup. Page also gives an error after the popup is closed.

    <html>
    <head><title>Random Webcam</title>

    <SCRIPT language="JAVASCRIPT">
    var Win;
    var page_index=0;
    var page = new Array();
    page[0] = "http://www.sunriseskipark.com/webcam2.shtml";
    page[1] = "http://www.skitiger.com/cams/beavercrk2.htm";
    page[2] = "http://snoweye.com/?page=us-ca&big=28";
    page[3] = "http://www.coppercolorado.com/NR/exeres/BB6518EE-FA6C-4A29-A41F-D1A824D42D23.htm";
    page[4] = "http://www.lowestonweb.com/";
    page[5] = "http://www.vantecusa.com/";

    function next_page()
    {
    page_index++;
    if (page_index == 6)
    page_index = 0;
    Win.location.replace(page[page_index]);
    }

    </SCRIPT>
    </head>

    <body>
    <h1>Page Rotator</h1>

    <SCRIPT language="JAVASCRIPT">

    Win=window.open(page[0], 'Win','resize=yes,toolbar=yes,status=yes,scrollbars=yes,screenX=0,screenY=0,width=1024,height=768')
    setInterval("next_page();",5000);
    </SCRIPT>

    </body>
    </html>

  2. #2
    SitePoint Zealot
    Join Date
    Dec 2006
    Posts
    188
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not sure if you can open a window without creating a new window. If you are just trying to show/hide certain text/images/forms you could do that with some code that hides a div and then shows it when you do an action. Do you have an example of what you are trying to recreate?

    Thanks

  3. #3
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    You're wanting some kind of stub that knows about the pages you want to rotate through, so that when the page changes, the scripting code isn't lost.

    You'll need to somehow remember the main window then open a new stub window that contains the script. The script from the stub then tells the main window to change.

    That should be possible, but how to achieve it is beyond my intentions to put the time to work on it.

  4. #4
    SitePoint Member
    Join Date
    Dec 2004
    Location
    Arizona
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Basically I am just trying to rotate webpages in the window that is initially open. Webcam webpages to be exact. I didn't want the page to popup, I just wanted it to rotate when the webpage was brought up.

  5. #5
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    In that case you could have the script control an iframe, which itself would take up the whole window.


Bookmarks

Posting Permissions

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