亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

怎么通過onclick事件獲取js函數(shù)返回值(代碼少)

 更新時間:2015年07月28日 17:04:06   投稿:mrr  
這篇文章主要介紹了怎么通過onclick事件獲取js函數(shù)返回值,需要的朋友可以參考下

具體過程不做詳細敘述,直接上代碼:

寫一個彈出框,綁定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函數(shù)返回值的全部代碼,希望對大家今后的學習工作有所幫助。

相關文章

最新評論