+ 2
How to start and end a program using two functions in the same onclick , please ?!
6 odpowiedzi
0
You have named functions as f1 and f2 but using as func() is wrong.. Use f1() , f2() in
onclick="f1()" for 1st radio buttons..
And ids should be unique in your total program so take different ids for <p>tags like
<p id="msg1"></p>
<p id="msg2"></p>
For 2nd radio button take : onclick="f2()"
And change in these id names like :
document.getElementById("msg1").innerHTML="correct";
document.getElementById("msg2").innerHTML="correct";
And remove extra brace { in line number 42..
Edit :
Riselda Rada
You can share code link here like this :
https://code.sololearn.com/WYeKxLp98s4c/?ref=app
+ 2
There are multiple way here are some
you can use nested function (onClick="func()")
//nested function
function func()
//1st function
function secondFunc(){
//2nd function
}
secondFunc()
}
or you can do
<button onclick="func(),secondFunc() ">click </button>
function func()
//1st function
}
function secondFunc(){
//2nd function
}
+ 1
Okay i am trying , thank you🤗
+ 1
Could you please look in my profile , it's called Game3 . I don't know what is going wrong with my code 🙁
+ 1
Thank you very much !! You helped me a lot😊😊
0
Try this :
onclick =" function1(), function2()"