+ 3
How to use image as a button in Java Script
I need a image to act as a button, i.e: when i click the image it must say "hi".
9 Answers
+ 6
<img src="" id="mybutton" onclick="butClick();">
in css
#mybutton{
cursor: pointer;
}
in js
function butClick(){
//...code
}
+ 5
thanks @ Rintaro 😂
+ 2
its done😂😂
hope u all like it😅
once again thanks for your help guyss!!
https://code.sololearn.com/WcJBGTkIdlV0/?ref=app
+ 2
//HTML
<img src="your own directory" onclick="newCall()">
//CSS
img {
cursor:pointer;
max-width:100%;
/*For centering an img*/
display:block;
margin:auto;
}
//JS
function newCall(){
//Alerts Hi!
alert("Hi!");
//Prints/Puts String "Hi!"
document.write("Hi!");
//Your Code:
/*
*/
}
+ 1
thanx guys!!
i making one simple html program😅
its almost finished i will upload as soon as it is done😉
+ 1
simply to put img tag in A tag.
<a><img src="" /></a>
0
Google it :)
0
I will show u