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
    New Coder
    Join Date
    Feb 2003
    Posts
    59
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Applying Arrays in Animated Window Opening?

    This is where I originally found the script:
    http://www.javascriptkit.com/script/cut119.shtml (opens only one link)

    This is currently the script i thought i could make it work to open multiple/different links:

    <head>
    <script>
    var mylocationArray= new Array('1sthtmdoc.htm', '2ndhtmdoc.htm')
    var winheight=100
    var winsize=100
    var x=5

    function go(){
    win2=window.open(mylocationArray[0],"","scrollbars")
    if (!document.layers&&!document.all){
    win2.location=mylocationArray[0]
    return
    }
    win2.resizeTo(100,100)
    win2.moveTo(0,0)
    go2()
    }
    function go2(){
    if (winheight>=screen.availHeight-3)
    x=0
    win2.resizeBy(5,x)
    winheight+=5
    winsize+=5
    if (winsize>=screen.width-5){
    win2.location=mylocationArray[1]
    winheight=100
    winsize=100
    x=5
    return
    }
    setTimeout("go2()",50)
    }

    </script>
    </head>
    And in between the <body></body>:
    <a href="java script:go()"
    onMouseover="window.status='open window';return true" onMouseout="window.status=''">TextLink 1 here</a>
    __________________________________________________
    My questions are: How do I have the script open the corresponding .htm document for each text link i want?? And what if I want to add more links?
    Thanks in advance for any replies! :)

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    10,966
    Thanks
    0
    Thanked 236 Times in 233 Posts
    use parameter in the function:

    <head>
    <script>
    var winheight=100
    var winsize=100
    var x=5

    function go(url){
    win2=window.open(url,"","scrollbars")
    if (!document.layers&&!document.all){
    win2.location=url;
    return
    }
    win2.resizeTo(100,100)
    win2.moveTo(0,0)
    go2(url)
    }
    function go2(url){
    if (winheight>=screen.availHeight-3)
    x=0
    win2.resizeBy(5,x)
    winheight+=5
    winsize+=5
    if (winsize>=screen.width-5){
    win2.location=url;
    winheight=100
    winsize=100
    x=5
    return
    }
    setTimeout('go2("'+url+'")',50)
    }

    </script>
    </head>
    And in between the <body></body>:
    <a href="javascript&#58;go('page1.htm')"
    onMouseover="window.status='open window';return true" onMouseout="window.status=''">TextLink 1 here</a>
    <a href="javascript&#58;go('page2.htm')"
    onMouseover="window.status='open window';return true" onMouseout="window.status=''">TextLink 2 here</a>

  • #3
    New Coder
    Join Date
    Feb 2003
    Posts
    59
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up i was close...

    Thanks man!....i was on the right track...until i got mixed up with the arrrays...yours is even better coz the docs contents gets to be seen while the page is still opening up.....

    .....Glenng-glenng

    Thanks in advance for any replies! :)


  •  

    Posting Permissions

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