Add a countdown timer to your item description
|
Script Part 1
<SCRIPT language=JavaScript1.2>
<!--// Dynamic countdown Script II- © Dynamic Drive (www.dynamicdrive.com)
// Modified for ebay auction by baconbuttie (i'm not worthy)
function setcountdown(theyear,themonth,theday,thehour,themin,thesec){
yr=theyear;mo=themonth;da=theday;hr=thehour;min=themin;sec=thesec
}
// modify the following lines to change the appearance of your timer
var occasion="Auction End"
var message_on_occasion="Auction Ended ! Did you bid in time ?"
var countdownwidth='520px'
var countdownheight='35px'
var countdownbgcolor='lightyellow'
var opentags='<font face="Verdana"><small>'
var closetags='</small></font>'
// don't change anything from here !!
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") : countdownie
countdown()
}
if (document.all||document.getElementById)
document.write('<center><span id="countdownie" style="width:'+countdownwidth+'; background-color:'+countdownbgcolor+'"></span></center>')
function countdown(){
var today=new Date()
var todayy=today.getYear()
if (todayy < 1000)
todayy+=1900
var 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+":"+todaysec
futurestring=montharray[mo-1]+" "+da+", "+yr+" "+hr+":"+min+":"+sec
dd=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(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+closetags
return
}
else 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+"Auction already ended ! "+closetags
return
}
else{
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>
</CENTER>
<!-- End of section to be inserted into description -->
|
Script Part 2
<!-- Insert this section as a revision, once you know the exact finish time
use the format setcountdown(yyyy,mm,dd,hh,min,sec) -->
<SCRIPT language=JavaScript>
<!--//
setcountdown(2003,12,25,00,00,01)
window.onload = start_countdown
//-->
</SCRIPT>
<!-- End of revision section -->
|
To use this script in your auction listing copy the whole of Part 1 of the code to the item
description box
in eBay and submit your item.
You will then need to add Part 2 of the code to your item description altering the time & date
(Highlighted in red)
to match the end date and time of your auction. You could either revise the item or add the
extra code as a comment.
Javascript by baconbuttie
|
|