0

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!!

2
Contributors
1
Reply
4
Views
9 Years
Discussion Span
Last Post by boyetp
0

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)"

function clickFunc(obj){
   if (id == img1"){
       ... your code here
  } else if(id == 'somethingelse'){
    ...
}
}

regards

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.