Nov 21, 2009

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

free web hosting
Open Discussion > MODERATED AREA > Computers > Programming Languages > Java, Java Servlets, Java Script, & JSP

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

Albus Dumbledore
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...

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="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='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") : countdownie
countdown()
}

if (document.all||document.getElementById)
[b]document.write('<span id="countdownie" style="width:'+countdownwidth+'; background-color:'+countdownbgcolor+'"></span>')[/b]

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>

<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

CODE
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://img.photobucket.com/albums/v610/123...90/325bec51.jpg thats the URL if your willing to help!

 

 

 


Comment/Reply (w/o sign-up)

beeseven
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.

Comment/Reply (w/o sign-up)

Saint_Michael
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
CODE

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


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

Comment/Reply (w/o sign-up)

Albus Dumbledore
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!!`

Comment/Reply (w/o sign-up)



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Similar Topics

Keywords : countdown, code, setting, image, background

  1. Image Rotater
    need help (2)
  2. Ajax Code Need Help Debugging.
    (9)
    I did a tutorial on ajax started to write my own It was all working well under safari but when i
    tried to test it out on other broswers it doesnt seem to work at all. I've spend a few hours
    already going over it and cant seem to figure it out at this stage. Heres the code that works under
    safari function createRequestObject(){ var request_o; //declare the variable to hold the object.
    var browser = navigator.appName; //find the browser name if(browser == "Microsoft Internet
    Explorer"){ /* Create the object using MSIE's method */ request_o = new ActiveXObj....
  3. Text Image Java Problem
    How to include text and image in some scrollable container? (1)
    Hello everyone, I am just writing some kind of text editor as practice for some school project and I
    have come to certain point where I can not solve certain problem. I wanted to make it available
    for people to insert images but I cannot figure how to combine images and text and which container
    should I use. I am working in Java and using swing. Also I would like to say that this content
    should be scrollable. So if anyone knows something about this and could be able to help me thanks in
    advance. Everyone opinion is accepted.....
  4. Ajax: Achieve Ajax Program In 5 Lines Of Code!
    (1)
    Well Last night, after a week of irritation and errors I finally created an easy Javascript object
    that easily and quickly allows you to develop an AJAX program in just 5 easy steps! Here's the
    link to the object I've created: http://www.demolaynyc.astahost.com/ajaxConn/ajaxConn.js
    Download it and read the Readme file that's under the same directory:
    http://www.demolaynyc.astahost.com/ajaxConn/Readme.html Basically what this object does is to
    connect to a server-side script (".php, .asp, .jsp, etc"), and what ever this script displays is
    sent back to t....
  5. How To Make This Type Of Link?
    Image change on mouseover (1)
    I cant figure out how to solve this problem.... I want to make link to be like this: When the page
    is loaded to have a pictures on it, but one picture is a link. I want to make this picture to change
    when I get my mouse cursor over her... I mean: when my mouse cursor is not on a picture then on page
    is loaded a "pic1.gif" file, but when my mouse cursor is over it, picture changes to a "pic2.gif".
    Thanks for help!....
  6. My Code Does Not Connect To Database
    always databases (1)
    Hi everyone! i am having a
    database connection problem, i am using this code to connet to
    the database -
    *******************attempCounter = 0****
    CODE public static Connection getDbConnection(String p_db, String p_schema) { Connection
    conn = null; int attemptCounter = 0; while (conn==null && attemptCounter { att....
  7. Help Writing An Html Code (onclick Open Something)
    (12)
    hi, I am new in web development i want to make a page in which there are few buttons and on click
    of each button there is some hidden text field which becomes visible and user can enter the text he
    wish to in it. how can i ?....
  8. How Do I Create An Array Of Objects?
    The code in the tutorial I have read returns an error upon compilation (3)
    I want to create an array of type Cards. Is this the right way of doing it? CODE Card decker
    ; decker = new Card ; I always get the error DeckofCards: java:47: missing return statement
    whenever I compile this.....
  9. Expanding Image Gallery
    Images Expanding on a mousover (6)
    I was looking through wired today, and i noticed :
    http://www.hotwired.com/webmonkey/06/08/index2a.html looks like a pretty nifty image gallery
    effect, though i noticed that it wont display properly in FireFox. Does anyone have any links or
    examples of other image gallery code, i find it pretty fascinating.....
  10. Fire Effect Code
    (0)
    Here's a good Fire code:- -easy to install -super small -lag free(in most browsers) -great
    look/effect! Here's the image, it goes upwards... So basically, your forum would have these
    fire images flying from bottom to the top. It is lag free, simple, looks great and best of all, it
    takes very less space in ur wrapper... All you have to do is simply put this code in your site in
    tags... That's it!!!All done!! Code From:- http://rpg.u4l.com
    Enjoy!! /cool.gif" style="vertical-align:middle" emoid="B)" border="0" alt="cool.gif"....
  11. Picture Enlargement
    javascript code (2)
    ok i have alot of pictures on my site and i need a way in which i can hold my mouse over the
    pictures and the picture can get bigger. I know it will be some kind of javascript or flash trick
    can anyone explain the prosess for it?....
  12. Button To Display An Image
    (1)
    I have an assignment that is due tomorrow that I am struggling with. I want to be able to click the
    next button in this applet, and then repaint all the graphics. Board contains an array with all of
    the chess pieces on a board, and when the button is clicked I want to be able to get the next move,
    but for now I just wanted to call a function to move one piece just so I know it's working. Here
    is my applet code, I could post all the other files, but I am almost positive they all work
    correctly, and I am just having trouble with the applet. Code: CODE import java....
  13. Problem To Update Jlabel With A Different Image..
    (2)
    Hi All, I am inplementing a preview function on a image file browser. The application displays a
    list of image file names, which the user can select (one at a time). The preview image is loaded
    into a JLabel. When an image file name is selected, the application creates a thumbnail image on the
    hard drive call "preview.jpg". The JLabel should then update itself with the newly created thumbnail
    "preview.jpg". For some reason I cannot get the Image in the JLabel to update. I have confirmed
    that "preview.jpg" is being rewritten, each time a new image file is selected from ....
  14. Numeric Countdown?
    Help needed (0)
    Hi everyone! I need an idea on how to make a simple numeric countdown for my page. The countdown
    should go from e.g. 10 seconds, to zero. When the counter hits zero, a disabled button that is
    located on my page should be enabled. I have made something like this with a script that I have
    downloaded and modified, but it consisted of a simple progress bar. Unfortunately, the script only
    worked in Internet Explorer, but not in Firefox (although I have Java installed). This counter has
    to be textual - only a piece of text that looks like "Please wait... xx", where xx is t....
  15. Needs Self-resetting Countdown Clock
    any help? (2)
    HEy, I hope i can post and ask for help here without getting into trouble. Anyways, I searched
    the web for countdown clocks and i just cant fid what i am looking for; What i find is a bunch of
    graphics, or generators that generate for like days and years at a time. What i am looking for is a
    clock that counts down from 24hrs to zero then resets hr:m:sec format. With so many scripts out
    there about countdown clocks i think it would be seemingly easy for those who know Java. Changed
    Topic Title from Html N00b, Needs Some Java Help to Needs Self-Resetting Countdown....
  16. Setting The Height Of A Tablerow
    Its variable so I want to use (4)
    I have a html page with a table. The next "image" shows the layout:
    -------------------------------------------------------------- HEAD CELL
    -------------------------------------------------------------- CONTENT | Main content cell LISTING
    | CELL... | --------- Now the "Content listing cell" should always reach the bottom (its a grey
    cell and the main content is white, so their should be two columns). If the main content cell's
    content is long enough so you can scroll down, their is no problem. But when the "Main content
    cell"'s content doesn't reaches ....
  17. Image Clocks
    (2)
    Does anyone know how to make you r own image clock (like a skin) for your website. The time displays
    like your system. you might take a look a this to know what i mean. So-You.net click here to see
    what i mean ...image clocks ....
  18. Image Show With Thumbnail And Fade
    Does anyone know were I can get this code? (2)
    Hi I would like to know if anyone knows a javascript that makes an thumbnail 'slideshow'
    and when mouseover...it fades...and when you click...it enlarges!!! I saw it somewhere here on the
    net but i cant finf it anymore!!! Can anyone help me...or does anyone know a good javascript
    site???? THANKS ....
  19. Resize Image Before Uploading
    (0)
    Hi, My upload and resizing scripts are working perfectly. Problem is clients are uploading large
    files and the script times out or connection timeout. Problem is with the bandwith and the slow
    connection in South Africa. I have increased the script timeout but it simply takes too long to
    upload. Clients forget that most didgital cameras files are massive and if they simple resize
    before uploading it will save them a huge amount of time. The final file is only 280 X 210 pixels.
    Uploading a 5Mb file over a 56k connection takes a month of Sundays. I have detailed instr....
  20. How To Insert Code With Javascript
    How to insert into a div an amount of code (11)
    Hi, I have the next html page CODE function insertcode() { var code =" blablabal babala
    babababab here comes header fadfafa anchor blalbababa " var myText =
    document.createTextNode(code); document.getElementById("content").appendChild(myText); } -->
    Insert Code This code insert the data as text. The html tags are not treated like markup.
    I need to insert the code in a time. I mean i can not go tag per tag. (E.g.
    document.createElement("p")... ) Is there any method to insert a pice of html code into a div and
    keep it like code not like tex....
  21. Onclick Image ->> Add Text To Input(text)field?
    (9)
    when some images get clicked, a text should added to an input(textfield). Does someone know how this
    can be done? I suppose it can be done via javascript. thanks in advance! /cool.gif' border='0'
    style='vertical-align:middle' alt='cool.gif' /> If you need more information, just ask
    /tongue.gif' border='0' style='vertical-align:middle' alt='tongue.gif' /> ....
  22. Rollover Background-image Button Ie
    Rollover background-image button IE (0)
    I find This Code On Search I Think for webmasters is good To Find Easy this Kind of code so i Type
    it here I Hope U enjoy it /blink.gif' border='0' style='vertical-align:middle' alt='blink.gif' />
    Step 1: Insert the below into the section of your page. Change the image path within ".initial"
    to reference the image you want applied initially to the button. .initial{ font-weight:bold;
    background-image:url(first.jpg); } CODE //Specify optional button target: "_new" for new
    window, or name of FRAME target (ie "myframe") var buttontarget="" if (docume....
  23. Eror 404 For Trap17
    The Code is Pretty Nice! (5)
    OpaQue, where did you get that JavaScript for the error 404 page for Trap17? It's something
    I've looked for for a long time! I 've tried before, but couldn't achieve the typing
    effect with JavaScript. I'd be very happy if you could tell me where you got it. /wink.gif'
    border='0' style='vertical-align:middle' alt='wink.gif' /> ....
  24. Java Script Drop Down Menu With Css
    - a full code for a dynamic drop down (2)
    Introduction This is a code that I use to dynamically create the drop down menus. First, you have
    to edit the following code and put it in your Javascript. Notice : /*** SET BUTTON'S FOLDER HERE
    ***/. Edit that to your folder. Also, the /*** SET BUTTONS' FILENAMES HERE ***/. This creates a
    mouseover when the drop down is activated. Put all your onmouseover images under: oversources = new
    array; and your onmouseout images under : upsources. Be sure to set your on and out images above
    each other. CODE /*** SET BUTTON'S FOLDER HERE ***/ var buttonFold....
  25. Hammurapi
    Java Code Review Tool (0)
    hi friends, I came across another useful tool, Hammurapi. It is a code review tool for Java. It
    parses thru java source files and generates a report stating all the violations to the standards.
    It is very much customizable so that u can define ur standards and it will report. It can be found
    at www.hammurapi.org It can also be called from an ant build file. I feel it wud be very useful
    for java projects and to maintain coding standards.....
  26. Image Scroller?
    (6)
    does anybody know where i can find a image scroller script? scrolling up and down?....

    1. Looking for countdown, code, setting, image, background

Searching Video's for countdown, code, setting, image, background
See Also,
advertisement


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

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com