473,835 Members | 1,813 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Display image if time elapsed is less than 24hours

adelemb
6 New Member
Hi all,

I want an image to display in a table if another table cell shows an updated date of less than 24hours. The date displayed in the cell is already working and display fine, but I have no idea where to start with calling the image!

This is to be used on a forum that displays a list of posted messages in a table. If a new message is posted under a topic, then I want an image to display for that topic indicating that there is something new - like a star or similar. We already have a table cell that displays the last updated date and time. Can I use this cell information to set up a bit of javascript to display the image? Or should I be using another coding language? Can it be done?

I can usually sort stuff like this out myself with a bit of online research but I need somewhere to start!

I can supply more info if needed, thanks for any help!!

Adele x
Feb 13 '08 #1
1 1669
tswaters
19 New Member
PHP Forum? If so, probably way easier to do on the server-side of things. if you wanted to do it with javascript ... creating the image is simple enough, do this in global scope:

Expand|Select|Wrap|Line Numbers
  1. newImage = document.createElement("IMG");
  2. newImage.src = "new.png"; newImage.border="0"
  3.  
but then where to put it's clones? you'd have to first, find elements where dates are stored, parse their text into dates, compare those dates with the current date to confirm it's < 24 hours.... finally, once you've confirmed you have an element of which contains a date < 24 hours ago -- you can do something like:

Expand|Select|Wrap|Line Numbers
  1. elem.parentNode.insertBefore( newImage.cloneNode(true) , elem ) 
  2.  
and that will make something like
[html]
<div id="imaparent" >
<span>2008-02-13</span> <img src="new.png" border="0">
</div>
[/html]
Feb 14 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

15
2040
by: kpp9c | last post by:
I am kind of in a bit of a jam (okay a big jam) and i was hoping that someone here could give me a quick hand. I had a few pages of time calculations to do. So, i just started in on them typing them in my time calculator and writing them in by hand. Now i realize, that i really need a script to do this because: 1. It turns out there are hundreds of pages of this stuff. 2. I have to do something similar in again soon. 3. By doing it by...
9
4099
by: Deepa | last post by:
Hi All, I'm facing problem displaying image of size 5000X5000 .My window size is smaller than image size so i'm not able to see the complete image.i can use scroll bars to view the image but i need to rotate the image and the see the result everytime. For this my boss has given me suggestion to display only 20% of the image on window ,and rotation has to be applied to original copy.
6
2730
by: Michael Bulatovich | last post by:
I have a very simple db I use for keeping track of hours, tasks, projects, clients etc. It has a form that I use to enter data. Currently the form has a textbox for a field called "start time", another for a field called "end time" and a third for a field called "hours", among other controls. I now type in the approximate times in the first two textboxes, and mentally calculate and enter the difference or elapsed time in the third. I...
6
4504
by: lauren quantrell | last post by:
I am using a timer to display the time it takes a user to complete a file transfer using the code below. The code below will display the total elapsed time, but is there a way to update the time continuously as the file is being downloaded? Help is greatly appreciated, lq Public sngStart as Single Public sngEnd as Single Public sngElapsed as Single
33
7471
by: ram.ragu | last post by:
hi i have problem to calculate idle time of cpu and if idle time is more then i have to shut down the system. can anyone tell me the idea to so that please
7
5414
by: eholz1 | last post by:
Hello Group, Perhaps you can help me. I have a mysql db, that holds images. Images are encoded using base64_decode/encode, etc. Image data seems fine. I have a view.php page that is supposed to show the image, and an image.php page that accesses the database, retrives the image data, and then (theoretically) prints the decoded data to the page. below is the view.php page code: problem area the img tag src no
12
16385
by: Spitfire | last post by:
I've a requirement to find the elapsed time between two function calls. I need to find the time elapsed accurate to 1 millisecond. The problem I'm facing right now is that, I'm using the 'time()' function call for the purpose and regardless of how many time I invoke the function within my program, I get the same output!!! For better clarity consider the code snippet below. ... start_time = time(NULL);
3
2926
by: timhoagland | last post by:
Hi, I have a C++ data acquisition program, running under Linux. The basic stucture is: Setup devices Acquire data for x seconds. Cleanup. The problem is that I don't have a way to determine how long the data
2
7607
by: dwasbig9 | last post by:
Hi Group (fairly limited knowledge of Access and almost none of Access VBA. Using Access 2003). I need to sum time, I've found through the groups archive an sql extract that led me to this SELECT Format(Sum(Table2.time),"Short Time") AS SumOftime FROM Table2; Which works fine but the article also said I would need a Function to
0
9810
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9653
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10526
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10237
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7770
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6970
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4435
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3999
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3094
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.