Submit Your Article Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register
 

Go Back   WebForumz.com > The Code > JavaScript

Reply
 
LinkBack Thread Tools
Old May 11th, 2009, 09:18 AM   #1
New Member
 

Join Date: Jun 2007
Location: India
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 jayaramgussy is on a distinguished road
Image Change based on the Value

Hi All,

Now I am creating a site for system availability.
If system returns 0 then monitor is turned off, If 1 then down, 2 then available based on the values i need to show the images to the end-users. like up image, down image and unavailable image. Please help me to do that one.
Also based on the values the system text-color should changed.
0=black
1=red
2=green.

Thanks in advance.
jayaramgussy is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old May 11th, 2009, 09:43 AM   #2
Reputable Member
 

Join Date: Nov 2008
Location: Lexington, KY
Posts: 243
Thanks: 0
Thanked 1 Time in 1 Post
Rep Altering Power: 0 Dubbs is on a distinguished road
Re: Image Change based on the Value

Assuming you can get the value to a variable in JavaScript, you can use something like this.

Code:
function SystemStatus(){
Switch (status)
 status = 0
  status_pic.innerHTML = "<span style='color: #000000'>Monitor 1</span> <img src='images/status_down.png' />"
  break;
 status = 1:
  status_pic.innerHTML = "<span style='color: #FF0000'>Monitor 1</span> <img src='images/status_off.png' />"
  break;
 status=2
  status_pic.innerHTML = "<span style='color: #00FF00'>Monitor 1</span> <img src='images/status_up.png' />"
 break;
}
Then in your HTML, you wil lhave the following.

Code:
<div id="status"> &nbsp;</div>
Then you will need to have update the value of status and the function at the same time, say every 30 seconds.
Dubbs is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Change background image based on folder structure linziharry Classic ASP 2 June 16th, 2008 12:49 PM
Change Background colour based on input smudge618 JavaScript 2 February 6th, 2008 07:55 AM
How to change dpi of image from 72 to 300 ? snowby PHP 4 November 15th, 2006 12:29 PM
Image change across frames kal JavaScript 2 October 24th, 2006 06:44 AM
Time based image display christopher JavaScript 1 April 19th, 2006 12:55 PM


Search Engine Optimization by vBSEO 3.2.0 RC8