Link to home
Start Free TrialLog in
Avatar of Whing Dela Cruz
Whing Dela CruzFlag for Anguilla

asked on

How to code on java with conditions?

Hi experts, I have a java code;

function getStuff()
{
    document.querySelector('#tuna').onclick=talk;
}

function talk()
{
    alert('tuna');
}
window.onload=getStuff;

My problem is I want to add another 1 like document.querySelector('#bacon').onclick=talk; then I want the word bacon will show on alert message.
Any help pls?
ASKER CERTIFIED SOLUTION
Avatar of mccarl
mccarl
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Whing Dela Cruz

ASKER

Thanks mccarl, its working!
You're welcome!