...

View Full Version : Applying Arrays in Animated Window Opening?



serendipity
02-19-2003, 10:10 PM
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?

glenngv
02-20-2003, 04:40 AM
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>

serendipity
02-20-2003, 04:56 PM
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

:thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum