Advanced Search

Results 1 to 4 of 4

Thread: Help Changing Color To Image

  1. #1
    Join Date
    Feb 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help Changing Color To Image

    ok, on this script here http://www.dynamicdrive.com/dynamici...dhtmlcount.htm there is the place for color..for what if i want to put an imagie in the background? can i change the color
    PHP Code:
    var countdownbgcolor='lightblue' 
    to somthing like
    PHP Code:
    var countdownbgimg='URL HERE"' 
    and then also change the different areas that say countdownbgimg to whatever it is edited to?

  2. #2
    Join Date
    Aug 2004
    Posts
    9,864
    Thanks
    3
    Thanked 960 Times in 949 Posts
    Blog Entries
    15

    Default

    If you wish to use a background image, it's easiest just to change the source directly. Change the line:

    Code:
    document.write('<span id="countdownie" style="width:'+countdownwidth+'; background-color:'+countdownbgcolor+'"></span>')
    so it reads instead:

    Code:
    document.write('<span id="countdownie" style="width:'+countdownwidth+'; background-image: url(\"path_to_image\")"></span>')
    where "path_to_image" is the path to the background image.

  3. #3
    Join Date
    Feb 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation

    omy, i know im a noob at this kind of stuff, thanx for your help ill see if it works and i am sure it will thanx again!

    *edit*

    well i tryed that but it does not want to work for me.....

    perhaps i have the code wrong somehow...

    Code:
    <script language="JavaScript1.2">
    
    /*
    Dynamic countdown Script-  Dynamic Drive (www.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, respectively
    var occasion="The 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 area
    var countdownwidth='200px'
    var countdownheight='50px'
    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") : countdownie
    countdown()
    }
    
    if (document.all||document.getElementById)
    document.write('<span id="countdownie" style="width:'+countdownwidth+'; background-image: url(\"http://img.photobucket.com/albums/v610/1234567890/325bec51.jpg")"></span>')
    
    window.onload=start_countdown
    
    
    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
    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 on day of occasion
    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
    }
    //if passed day of occasion
    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+"Occasion already passed! "+closetags
    return
    }
    //else, if not yet
    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>
    that is the full thing i have.. plz help lol
    Last edited by Big Red; 02-16-2006 at 03:54 AM. Reason: added instead of double posting

  4. #4
    Join Date
    Feb 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    i have edited the post above, please see below *edit* line

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •