How To Add On Click Event For Button That Appeared On Mouseover
Solution 1:
Yes this is possible, what you have to do is define all six button as you want and set property in style display:none
and when you will over the mouse on the image and when you wand to show all six images then call a function onmouseover
and set the display:none
property display:''
in this way when you will mouse over on the image all the images will get displayed
2nd you may write the onClick
with each button and it will work fine.
Hope will work for you.
This will be the code for each button out of six
<inputtype="button"id="btn1" Onclick="onClickFunc()" style="display:none" value="Button1" />
Solution 2:
Yes Why Not !!!
- I want to display 6 buttons around an image on mouseover of the image on specific positions. Is it possible? ANS :- give every button same class like 'imgBtn' and make it by default display none. At the time of mouse oven on image you can write code
in jquery like :-
jQuery('#imageID').hover(function(){
jQuery('imgBtn').show();
})
in javascript :
paste this line on img tag in
onmouseover="document.getElementsByClassName("redText").style.visibility = 'visible';"
- Is it possible to write an onclick event for those buttons? I don't have any experience in web designing. So kindly help me. Thank you
ANS: yes you can write any function on onclick on button like :
jQuery('#buttonID').click(function(){
//button functionality
})
Solution 3:
OK, the only solution that comes to my mind is making use of image maps and jquery.
I have built a rough demo, you may have to enhance it as per your requirements.
Here is a demo
All the boxes except the one in the center is an image map. When you hover you mouse over any of the image maps, I show a button with the help of jquery.
Solution 4:
Set the image as a background for one div. Inside that div create another one div and write the code for 6 buttons in it.
Normally set display:none
for this buttons div, While hover that image from javascript function you can set display:block
from javascript then that six buttons will display on the image.
The following is the code for witing onclick event for button.
<button type="button" Onclick="alert('hai')">Click Me!</button>
Post a Comment for "How To Add On Click Event For Button That Appeared On Mouseover"