var one= document.getElementById("OneOp");
one.addEventListener("click",function1,false);
var two= document.getElementById("twoOp");
two.addEventListener("click", function1,false);
var three= document.getElementById("threeOp");
three.addEventListener("click", function1,false);
all of them go to fucntion1, once the I need to know which button, and then use than in information in function1, (out of one two or three). if there any way to do check it? I was thinking implementing a if else statement of some kind, but I can't seem to figure out the right sintax using javascript.
I am very new at javascript, I would appreciate any input.
thanks in advance.
Use the target
property of the event object
function function1(event){
var clickedId = event.target.id;
if(clickedId == 'OneOp'){
}
else if
.
.
.
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.