Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Basic Question: Showing Updated GIF in JavaScript

Status
Not open for further replies.

obeltrami

Programmer
Joined
Jun 24, 2006
Messages
2
Location
FR
I am a proficient C++ and Delphi programmer, but when it comes to JavaScript I am totally lost. So please excuse the extremely basic question (which I could not find a solution for, using the search).

I have an HTML page (used as a Windows desktop wallpaper) that my Delphi program generates, showing a map of the world with the times in different cities (see The HTML page has a javascript loop that regularly updates the time, and when it's night in a particuylar city, the dot is grey and when it's daylight, the dot is yellow. Works fine so far.

Now, I want to add a curve showing the parts of the globe in sunlight and the parts in darkness. My Delphi app calculates all the rising/setting times, create a transparent GIF image in memory and saves it to file. So far, so good.

The problem is that, from within the JS of my HTLM file, I cannot get my GIF to display. The background is there, the city dots are there, but not my transparent GIF.

Can anyone show me some sample code to be placed in my loop to simply display my transparent GIF at (0,0) on top of my background image. The image size is 1600 by 1200.

Any help would be greatly appreciated.

Olivier
 
Perhaps you could show us the code you have so far? I see no JS or HTML - only a .exe file, which I really don't want to download and install purely to help you with a JS problem.

To display a GIF as a background image, you need only 1 line. Assuming your container has an ID of "wibble", you would use:

Code:
document.getElementById('wibble').style.backgroundImage = 'url(someFileNameHere.gif)';

Hope this helps,
Dan

Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Hello Dan,

Thanks for the post. I finally found what I needed; innerHTML. I know it has a bad rap (from what I've read) as being MS-centric, but as my Html/JS file is used as a Windows Desktop wallpaper, it's not a real limitation for me ;-)

Thanks again.

Olivier
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top