A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Pop-up windows with JavaScript...

  1. #1
    I have different windows opening up on a few different buttons and the code below is what I'm using on my HTMl page. On each button I have the Get URL action with "javascript: openMovie1" and so on. But the problem I'm having is that it only opens one window, not all of them. Any suggestions on the what I should do or how I'm configuring this wrong. Any help is much appreciated!!!

    <script language="javascript">
    function openMovie1(){
    window.open("movie1.htm","movie","width=640,height =480,status=yes,location=no")
    }
    function openMovie2(){
    window.open("movie2.htm","movie","width=640,height =480,status=yes,location=no")
    }
    function openMovie3(){
    window.open("movie3.htm","movie","width=800,height =600,status=yes,location=no")
    }
    function openMovie4(){
    window.open("movie4.htm","movie","width=800,height =640,status=yes,location=no")
    }
    function openMovie5(){
    window.open("movie5.htm","movie","width=777,height =505,status=yes,location=no")
    }
    </script>

  2. #2
    You've named the window 'movie' in all your functions. You're creating the same widow each time. Change the name of each to movie1, movie2 etc eg: window.open("movie1.htm","movie1"... not window.open("movie1.htm","movie"...

    If you're trying to call all at once, you also need a new function calling them all.

    <script language="javascript">

    function openAll() {
    openMovie1();
    openMovie2();
    openMovie3();
    openMovie4();
    openMovie5();
    }

    function openMovie1(){
    window.open("movie1.htm","movie1","width=640,heigh t=480,status=yes,location=no")
    }
    function openMovie2(){
    window.open("movie2.htm","movie2","width=640,heigh t=480,status=yes,location=no")
    }
    function openMovie3(){
    window.open("movie3.htm","movie3","width=800,heigh t=600,status=yes,location=no")
    }
    function openMovie4(){
    window.open("movie4.htm","movie4","width=800,heigh t=640,status=yes,location=no")
    }
    function openMovie5(){
    window.open("movie5.htm","movie5","width=777,heigh t=505,status=yes,location=no")
    }

    </script>


    <a href="javascript:openAll()">test</a>


  3. #3
    Thanks for the help. I guess I should've been more specific. I wanted different buttons to open the different windows. ButI figured it out last night. My problem was that I was putting the JavaScript within the Body of the HTML page and not in the Head. Stupid mistake on my part!

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center