Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Updating image according to another value
Old 04-23-2009, 09:30 AM Updating image according to another value
Junior Talker

Posts: 3
Name: Jeckle
Trades: 0
im trying to update an image on the page depending on the value given in a textbox.
If the value is 100 then the picture should automatically change, using javascript.

thanks
Fran the noob is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-23-2009, 09:43 AM Re: Updating image according to another value
Average Talker

Posts: 26
Trades: 0
this value 100 is given manually by the viewer or it is automated
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
ltimranjaved is offline
Reply With Quote
View Public Profile Visit ltimranjaved's homepage!
 
Old 04-23-2009, 09:45 AM Re: Updating image according to another value
Junior Talker

Posts: 3
Name: Jeckle
Trades: 0
it is calculated by the number of checkboxes checked by the user.
Fran the noob is offline
Reply With Quote
View Public Profile
 
Old 04-23-2009, 11:39 AM Re: Updating image according to another value
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
Code:
var checkboxes = [];
var count = 0;
var inputs = document.getElementsByTagName("input");
for(var i = 0; i < inputs.length; i++) {
   if(inputs[i].type == "checkbox") {
      checkboxes.push(inputs[i]);
       inputs[i].onchange = function() {
           count = 0;
           for(var n = 0; n < checkboxes.length; n++) {
              if(checkboxes[n].checked) count++;
           }
           document.getElementById("my-image-id").src = "/pathto/imagename" + count;
       }
}
Something like that should work. Are you able to understand the code?
__________________
Join me on
Please login or register to view this content. Registration is FREE
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 04-23-2009, 11:40 AM Re: Updating image according to another value
Junior Talker

Posts: 3
Name: Jeckle
Trades: 0
hey,

will try that out, can understand it too !

thanks !
Fran the noob is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Updating image according to another value
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.16424 seconds with 12 queries