This article mainly introduces how to obtain the js function return value through the onclick event. If you need it, you can refer to the specific process without further details and directly go to the Code:
Write a pop-up box and bind the onclick event as if it cannot control its return value. The Code is as follows:
Function createBtn () {for (var I = 0; I <_ this. btn. length; I ++) {var btn = document. createElement ('span '); btn. id = 'btn _ '+ I; btn. innerHTML = _ this. btn [I]; btn. style. padding = '5px 15px '; btn. style. background = '# e5e5e5'; btn. style. borderRadius = '5px '; btn. style. marginRight = '15px '; btn. style. cursor = 'pointer '; document. getElementById ('btn _ box '). appendChild (btn); // btn. onclick = closeBox;} function closeBox () {var box = document. getElementById ('msg _ box'); box. remove (); if (this. id = 'btn _ 0') {isBool = true;} else {isBool = false;} return isBool ;}
The above code is all the code that gets the js function return value through the onclick event, hoping to help you in your future study.