Practical and Useful Information For Enhancing Your Site

Scrolling Window

Scripts do not work in Netscape 4.x.

These scripts open and close a window with a scrolling effect. Click on the link below to see the script in action.

Open Scrolling Window

Opening The Window With A Scrolling Effect

The following code goes in an external JavaScript file or between the <head></head> tags of the page:

<script type="text/javascript">
/**************************************************************/
/* AUTHOR: Kochu */
/* EMAIL: rajeshkochu@hotmail.com */
/**************************************************************/
function MM_openBrWindow(theURL,winName,features)
{ //v2.0
window.open(theURL,winName,features);
}
</script>

Next, add the following code to the HTML page where you want the link to open the scrolling window:

<a href="#" onclick="MM_openBrWindow('cards.html',
'','scrollbars=to,width=300,height=60,top=40,left=40')">
Open Scrolling Window</a>

Closing The Window With A Scrolling Effect

The new window will also close with a scrolling effect. On the page that is being opened in the new window, add the following code between the <head></head> tags of the page:

<script type="text/javascript">
/**************************************************************/
/* AUTHOR: Kochu */
/* EMAIL: rajeshkochu@hotmail.com */
/**************************************************************/
var window_width = 270;
var window_height = 500;
var h = 150;
function winopen(theURL,winName,features)
{
window.open(theURL,winName,features);
}
firstrun();
function firstrun()
{
self.focus();
if(h < window_height)
{
h = h + 5;
setTimeout ("secondrun(h)",50);
}
}
function secondrun(h)
{
self.resizeTo (window_width,h);
firstrun()
}
function firstruns()
{
self.focus();
if(h <= window_height)
{
h = h - 5;
setTimeout ("closes(h)",50);
}
if(h == 150)
{
window.close()
}
}
function closes(h)
{
self.resizeTo (window_width,h);
firstruns()
}
</script>

Finally, enter the following code where you want "Close Window" to appear:

<a href="javascript:firstruns()">Close Window</a>