具体过程不做详细叙述,直接上代码:

写一个弹出框,绑定onclick事件是好像控制不了它的返回值。代码如下

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;
}

以上代码就是通过onclick事件获取js函数返回值的全部代码,希望对大家今后的学习工作有所帮助。

标签:
js获取函数返回值,js获取返回值

免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
狼山资源网 Copyright www.pvsay.com