PDA

View Full Version : Drop-in content box



texasgal
11-22-2004, 01:20 PM
http://www.dynamicdrive.com/dynamicindex17/dropinbox.htm

Could someone help me modify this script to have a timer? I would only like the box to display for 10 days.

Nate_Bro
11-22-2004, 04:56 PM
i'm working on it :)

texasgal
11-23-2004, 06:10 PM
Thanks.

Nate_Bro
11-24-2004, 12:24 AM
sorry but it might be another day, i have got a lot of work to do, but if someone else does not get back before i do then i'll get it for you :) hope thats ok

Nate_Bro
11-24-2004, 05:02 AM
see if you like this....



<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 2</title>
<script language="JavaScript1.2">

// Drop-in content box- By Dynamic Drive
// For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
// This credit MUST stay intact for use
// Date plugin by Nate_Bro

var ie=document.all
var dom=document.getElementById
var ns4=document.layers
var calunits=document.layers? "" : "px"

var bouncelimit=32 //(must be divisible by 8)
var direction="up"

d = new Date();
var dt1 = (d.getMonth() + 1);
var dt2 = d.getDate();
var dt3 = d.getYear();



// Date format is MM/DD/YY
var enddate = "11/25/2004" // End date, the day you want the box to NOT show on ########### EDIT ############




var date3 = enddate
var lead_slashes = date3.indexOf("/");
var start = lead_slashes + 1;
var without_resource = date3.substring(start,date3.length);
var next_slash = without_resource.indexOf("/");
var datefin3 = without_resource.substring(0, next_slash);
var date2 = enddate
var without_resource2 = date2
var next_slash2 = without_resource2.indexOf("/");
var datefin2 = without_resource2.substring(0, next_slash2);

function initbox(){

if (((dt1 <= datefin2)&&(dt2 < datefin3))||(dt1 < datefin2)){

if (!dom&&!ie&&!ns4)
return
crossobj=(dom)?document.getElementById("dropin").style : ie? document.all.dropin : document.dropin
scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
crossobj.top=scroll_top-250+calunits
crossobj.visibility=(dom||ie)? "visible" : "show"
dropstart=setInterval("dropin()",50)
}
}

function dropin(){
scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
if (parseInt(crossobj.top)<100+scroll_top)
crossobj.top=parseInt(crossobj.top)+40+calunits
else{
clearInterval(dropstart)
bouncestart=setInterval("bouncein()",50)
}
}

function bouncein(){
crossobj.top=parseInt(crossobj.top)-bouncelimit+calunits
if (bouncelimit<0)
bouncelimit+=8
bouncelimit=bouncelimit*-1
if (bouncelimit==0){
clearInterval(bouncestart)
}
}

function dismissbox(){
if (window.bouncestart) clearInterval(bouncestart)
crossobj.visibility="hidden"
}

function truebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}


window.onload=initbox

</script>
</head>

<body>

<div id="dropin" style="position:absolute;visibility:hidden;left:200px;top:100px;width:500px;height:300px;background-color:#F5F5F5">

<div align="right"><a href="#" onClick="dismissbox();return false">[Close Box] </a></div>

SPECIFY YOUR CONTENT HERE. IT COULD BE TEXT, IMAGES, OR RICH HTML

</div>
</body>

</html>

texasgal
11-24-2004, 02:22 PM
This is perfect. I beleive this will work.

Is there a way to set the start date too?

Thanks so much.

Have a great Turkey Day!

Nate_Bro
11-24-2004, 03:38 PM
lol, thanks........

and yes there is, lol

my first go at it had a start date but when i rewrote it to make it smaller i left it out, but ya, I'll do that too :)

Nate_Bro
11-27-2004, 05:23 AM
sorry that its taking so long, but i just got back and i might have it done tomarow :)