Click to See Complete Forum and Search --> : Scroll window from top right position of a web page


shanuragu
08-07-2003, 06:12 AM
HI

While browsing the Net I came across this window advertisement, few seconds after the web page is loaded, it appears from the top of the page (below the address bar) display the advertisement for a minute & disapears.

Just thought of impelmenting this type of advertisement into my new web site. Can any one help me in this regard????

shara

AdamBrill
08-07-2003, 07:47 AM
Do you mean the ones that "float" on top of the page? If so, you just have to create a div and position it absolutely wherever you want the advertisement to go...

shanuragu
08-07-2003, 08:50 AM
Not exactly float on the page I can say it just scrolls down/ roll down (does go down scrolling) from the top center of the page.

Even if I use div & position it will it float ???

shara

AdamBrill
08-07-2003, 10:15 AM
I'm not sure if this is what you want or not, but take a look at this:<html>
<head>
<title>Untitled</title>
<script type="text/javascript">
function move_add(){
element=document.getElementById('move_div');
element.style.top = parseInt(element.style.top)+5;
if(parseInt(element.style.top)<100){
setTimeout('move_add()',50);
}
}
</script>
</head>
<body onload="setTimeout('move_add();',500);">
<div id="move_div" style="position:absolute; top:-200px; left:200px; width:200px; height:200px; color:black; background-color:lightgrey; border:1px solid black;">
<div id="menu_div" style="position:absolute; top:0px; left:0px; width:100%; height:20px; color:lightgrey; background-color:gray; border-bottom:1px solid black;">
<div id="x_div" style="position:absolute; top:0px; width:20px; height:20px; left:179px; color:white; background-color:black; text-align:center;" onclick="document.getElementById('move_div').style.display='none';">X</div>
The ad name..
</div>
<div id="ad_body" style="position:absolute; top:20px; left:0px; width:100%; color:white; ">
The add text or whatever...
</div>
</div>
</body>
</html>Let me know if that's what you wanted. ;)

pyro
08-07-2003, 10:17 AM
And, if you are trying to use an actual window, you need to look into moveTo() (http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/window.html#1202631) or moveBy() (http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/window.html#1202585)

shanuragu
08-08-2003, 12:07 AM
Thanks Adam!!!

This is what I really wanted. But How can I make this window automatically get closed after some time say 1min.

shara

AdamBrill
08-08-2003, 07:00 AM
Here:

<html>
<head>
<title>Untitled</title>
<script type="text/javascript">
function move_add(){
element=document.getElementById('move_div');
element.style.top = parseInt(element.style.top)+5;
if(parseInt(element.style.top)<100){
setTimeout('move_add()',50);
}else{
setTimeout("document.getElementById('move_div').style.display='none';",60000);
}
}
</script>
</head>
<body onload="setTimeout('move_add();',500);">
<div id="move_div" style="position:absolute; top:-200px; left:200px; width:200px; height:200px; color:black; background-color:lightgrey; border:1px solid black;">
<div id="menu_div" style="position:absolute; top:0px; left:0px; width:100%; height:20px; color:lightgrey; background-color:gray; border-bottom:1px solid black;">
<div id="x_div" style="position:absolute; top:0px; width:20px; height:20px; left:179px; color:white; background-color:black; text-align:center;" onclick="document.getElementById('move_div').style.display='none';">X</div>
The ad name..
</div>
<div id="ad_body" style="position:absolute; top:20px; left:0px; width:100%; color:white; ">
The add text or whatever...
</div>
</div>
</body>
</html>

You can change the time to however long you want it to wait before closing. Right now it is set to 60,000 milliseconds(one minute).

shanuragu
08-08-2003, 11:29 PM
It is working fine !!!
Thanks Adam:D

AdamBrill
08-09-2003, 04:52 PM
No problem. I'm glad I could help out. :)