Jump to content
xisto Community
Sign in to follow this  
Albus Dumbledore

Countdown Code Help I need help setting an image as the background.

Recommended Posts

Ok, now for scripts like this i am not to well of working with..and i am in need of a bit of help, i would like to set a background image as the background not a color...

<script language="JavaScript1.2">/*Dynamic countdown Script- � Dynamic Drive 
(dynamicdrive.com; For full source code, 100's more DHTML scripts, and TOS,
visit http://www.dynamicdrive.com/ /*/function setcountdown(theyear,themonth,theday){yr=theyear;mo=themonth;da=theday}//////////CONFIGURE THE COUNTDOWN SCRIPT HERE////////////////////STEP 1: Configure the countdown-to date, in the format year, month, day:setcountdown(2006,03,07)//STEP 2: Change the two text below to reflect the occasion, and message to display on that occasion, respectivelyvar occasion="Release Of the GoF DVD"var message_on_occasion="The Gof DVD Is Out! Go And Get It!"//STEP 3: Configure the below 5 variables to set the width, height, background color, and text style of the countdown areavar countdownwidth='338px'var countdownheight='105px'var countdownbgcolor='lightblue'var opentags='<font face="Verdana"><small>'var closetags='</small></font>'//////////DO NOT EDIT PASS THIS LINE//////////////////var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")var crosscount=''function start_countdown(){if (document.layers)document.countdownnsmain.visibility="show"else if (document.all||document.getElementById)crosscount=document.getElementById&&!document.all?document.getElementById("countdownie") : countdowniecountdown()}if (document.all||document.getElementById)[b]document.write('<span id="countdownie" style="width:'+countdownwidth+'; background-color:'+countdownbgcolor+'"></span>')[/b]window.onload=start_countdownfunction countdown(){var today=new Date()var todayy=today.getYear()if (todayy < 1000)todayy+=1900var todaym=today.getMonth()var todayd=today.getDate()var todayh=today.getHours()var todaymin=today.getMinutes()var todaysec=today.getSeconds()var todaystring=montharray[todaym]+" "+todayd+", "+todayy+" "+todayh+":"+todaymin+":"+todaysecfuturestring=montharray[mo-1]+" "+da+", "+yrdd=Date.parse(futurestring)-Date.parse(todaystring)dday=Math.floor(dd/(60*60*1000*24)*1)dhour=Math.floor((dd%(60*60*1000*24))/(60*60*1000)*1)dmin=Math.floor(((dd%(60*60*1000*24))%(60*60*1000))/(60*1000)*1)dsec=Math.floor((((dd%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1)//if on day of occasionif(dday<=0&&dhour<=0&&dmin<=0&&dsec<=1&&todayd==da){if (document.layers){document.countdownnsmain.document.countdownnssub.document.write(opentags+message_on_occasion+closetags)document.countdownnsmain.document.countdownnssub.document.close()}else if (document.all||document.getElementById)crosscount.innerHTML=opentags+message_on_occasion+closetagsreturn}//if passed day of occasionelse if (dday<=-1){if (document.layers){document.countdownnsmain.document.countdownnssub.document.write(opentags+"Occasion already passed! "+closetags)document.countdownnsmain.document.countdownnssub.document.close()}else if (document.all||document.getElementById)crosscount.innerHTML=opentags+"Occasion already passed! "+closetagsreturn}//else, if not yetelse{if (document.layers){document.countdownnsmain.document.countdownnssub.document.write(opentags+dday+ " days, "+dhour+" hours, "+dmin+" minutes, and "+dsec+" seconds left until "+occasion+closetags)document.countdownnsmain.document.countdownnssub.document.close()}else if (document.all||document.getElementById)crosscount.innerHTML=opentags+dday+ " days, "+dhour+" hours, "+dmin+" minutes, and "+dsec+" seconds left until "+occasion+closetags}setTimeout("countdown()",1000)}</script><ilayer id="countdownnsmain" width=&{countdownwidth}; height=&{countdownheight}; bgColor=&{countdownbgcolor}; visibility=hide><layer id="countdownnssub" width=&{countdownwidth}; height=&{countdownheight}; left=0 top=0></layer></ilayer>
 

ne ways, i was told by a friend to change the aspects in bold to this

document.write('<span id="countdownie" style="width:'+countdownwidth+'; background-image: url(\"path_to_image\")"></span>')
and i did, but i could not get it to work...maybe there is somthing in missing? if you are willing to help me with this lol help is much appreciated..im doing it for a site im at... http://forums.xisto.com/no_longer_exists/404.png thats the URL if your willing to help!

Share this post


Link to post
Share on other sites

Did you make sure to use the entire image path (including the http)? The only other thing I can think of would be to try changing the \" to \', but I doubt it would actually matter. It would help if you provided us with a link to the page.

Share this post


Link to post
Share on other sites

thats easy do it like this

Step 1 Create a Table set up or if you use css do the same thing

Step 2: set the image as a background

<td background="yourimagehere.jpg">place javascript here</td>

Step 3: Put your javascript into that table and it should work.

Share this post


Link to post
Share on other sites

well that didn't work out for me >_< so for now all i did was use iframes, a lame way of doing it but i did it and made the iframe the same size as the image and it worked...so i would concider this topic closed..resolved..complete..lol, it may be closed!!`

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.