User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 402,653 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,178 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 689 | Replies: 1
Reply
Join Date: Apr 2008
Posts: 17
Reputation: vanessia_1999 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
vanessia_1999 vanessia_1999 is offline Offline
Newbie Poster

if else statement using onclick

  #1  
Apr 24th, 2008
hi, i am new to this group. i cam across it when i was looking for help on the web with the informations that is out there.
i am a beginner website programmer. hint the word begginner. i am learning javascript and it is giving me a huge migraine.
i would like to know if anyone can help me understand how can i write a if else statement to onclick two images if one is < than 5 else > than 10
i know it sound easy but i been working on this part for a whole week!!
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Apr 2008
Posts: 6
Reputation: boyetp is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
boyetp boyetp is offline Offline
Newbie Poster

Re: if else statement using onclick

  #2  
Apr 25th, 2008
Originally Posted by vanessia_1999 View Post
hi, i am new to this group. i cam across it when i was looking for help on the web with the informations that is out there.
i am a beginner website programmer. hint the word begginner. i am learning javascript and it is giving me a huge migraine.
i would like to know if anyone can help me understand how can i write a if else statement to onclick two images if one is < than 5 else > than 10
i know it sound easy but i been working on this part for a whole week!!



I'm not exactly sure what you're trying to accomplish.
But there are plenty of way's to do this.

You can put an id into you image and pass itself(this) to the function.

ex.

<img id="img1" ... onclick="clickFunc(this)"



  1. function clickFunc(obj){
  2. if (id == img1"){
  3. ... your code here
  4. } else if(id == 'somethingelse'){
  5. ...
  6. }
  7. }
  8.  


regards
Last edited by peter_budo : Apr 26th, 2008 at 2:29 pm. Reason: Keep It Organized - please use [code] tags
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JavaScript / DHTML / AJAX Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 3:22 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC