var dialogBox;//全局化
apiready = function() {
// 引入dialogBox对话框
dialogBox = api.require('dialogBox');
}
// 弹出对话框
function fnEjectDialogBox() {
var data= 'default';
dialogBox.input({
keyboardType: 'number',
texts: {
title: '您的内容',
placeholder: '输入内容',
default:data
leftBtnTitle: '取消',
rightBtnTitle: '确定'
},
styles: {
bg: '#fff',
corner: 6,
w: 300,
h: 200,
title: {
h: 60,
borderColor: '#336699',
alignment: 'center',
size: 20,
color: '#000',
marginT: 20,
},
input: {
h: 40,
y: 40,
alignment: 'left',
marginT: 15,
marginLeft: 10,
marginRight: 10,
textSize: 18,
textColor: '#000',
// borderColor:'#eee',
borderWidth: '1',
verticalCenter: true,
},
dividingLine: {
width: 0.5,
color: '#696969'
},
left: {
bg: 'rgba(0,0,0,0)',
color: '#007FFF',
size: 12
},
right: {
bg: 'rgba(0,0,0,0)',
color: '#007FFF',
size: 12
}
}
}, function(ret) {
api.alert({
msg: JSON.stringify(ret)
});
if (ret.eventType == 'left') {
var dialogBox = api.require('dialogBox');
dialogBox.close({
dialogName: 'input'
});
}
});
}
************************************html****************************************
<div class="title" id="my_phone" onclick="fnEjectDialogBox();">
<span class="have">查看</span>
</div>