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 5 of 5
  1. #1
    New Coder
    Join Date
    Mar 2005
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Popup/Frame Control

    I am very new to Javascript, and I do not intend on learning it. I am a PHP/SQL coder, and am looking to do something with Javascript, as I see it as the best way.

    I want to be able to control a Javascript popup window, or frame within the page.

    Let's say I have a popup window. Let's call this POPUP1. What I want POPUP1 to do, is simple. I want to be able to declare all it's properties.

    Specifically, what I am looking to do, is this:

    POPUP1 should open up, and navigate to http://site1.com. In x amount of seconds, I want POPUP1 to navigate to http://site2.com. This should all happen in one local popup window.

    I am sure that this is all very simple! It'd appriciate it if someone could also teach me how to do this with frames/iframes, with the same specification, but calling it FRAME1.

    Thanks alot,

    - VC

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Will the opener still be loaded while the popup is open?

    If so you could possibly go like this

    Code:
    <HTML>
    <HEAD>
    <TITLE>Document Title</TITLE>
    
    <script type="text/javascript">
    <!--
    
    urls=new Array()
    urls[0]="http://www.codebrain.com"
    urls[1]="http://www.hrgiger.com"
    urls[2]="http://www.joecartoon.com"
    urls[3]="http://www.dhtmlnirvana.com"
    
    time=5000
    count=0
    
    function openWin(){
    newWin=window.open(urls[count],'win1','left=100,top=100,width=600,height=400')
    setTimeout("nextUrl()",time)
    }
    
    function nextUrl(){
    
    if(newWin&&newWin.open&&!newWin.closed){
    count++
    
    if(count==urls.length){
    count=0
    }
    
    newWin.location=urls[count]
    
    setTimeout("nextUrl()",time)
    }
    }
    
    //-->
    </script>
    </HEAD>
    <BODY>
    
    <a href="#null" onclick="openWin()">Open Pop</a>
    
    </BODY>
    </HTML>
    Last edited by Mr J; 08-17-2005 at 07:52 PM.
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.

  • #3
    New Coder
    Join Date
    Mar 2005
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks, but I need a bit more help.

    I understand what that does, and I understand each line. In the various arrays of the "urls" variable:

    Code:
    urls[0]="http://www.codingbrain.com"
    
    etc...
    How would I go about using javascript within. Here is an example:

    Code:
    urls[0]="window.location='http://site.com'"
    I know that example is useless, but you get what I am asking. Any help?

  • #4
    Regular Coder
    Join Date
    Aug 2002
    Location
    Oregon, United States of America
    Posts
    882
    Thanks
    1
    Thanked 9 Times in 9 Posts
    I suggest opening a new window with the script above, or one similar. The new window would then go to your page. On this page you would have a 100% frame, that has the site you want to show. Then you put the site changing script in your page.
    If I'm postin here, I NEED YOUR HELP!!

  • #5
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Sorry but I am a bit confused, can you explain a bit more why you want it this way

    urls[0]="window.location='http://site.com'"
    Meanwhile, if the parent window is not going to be loaded all the time the popup is opened you can go this way.

    In the parent page

    Code:
    <a href="#null" onclick="window.open('urlspop.htm')">Open Pop</a>
    In urlspop.htm

    Code:
    <HTML>
    <HEAD>
    <TITLE>Document Title</TITLE>
    
    <script type="text/javascript">
    <!--
    
    urls=new Array()
    urls[0]="http://www.hrgiger.com"
    urls[1]="http://www.joecartoon.com"
    urls[2]="http://www.dhtmlnirvana.com"
    
    time=5000
    count=0
    
    function nextUrl(){
    document.getElementById("myiframe").src=urls[count]
    
    count++
    
    if(count==urls.length){
    count=0
    }
    
    setTimeout("nextUrl()",time)
    }
    
    
    //-->
    </script>
    </HEAD>
    <BODY onload="nextUrl()" style="margin:0;overflow:hidden">
    
    <iframe src="" id="myiframe" width=100% height="100%"></iframe>
    
    
    </BODY>
    </HTML>
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.


  •  

    Posting Permissions

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