[骗点,渣译]WindowsPhone跟PhoneGap #04
[骗点,渣译]WindowsPhone和PhoneGap #04
原文
在PhoneGap中显示MessageBox (第一扒)
PG的API提供了直接调用:”notification.alert”。
比如说,你想点击一个按钮之后,显示一个HelloKitty。那你只需要在html中这样写:
<script type="text/javascript">
function Button1_onclick(){ navigator.notification.alert("HelloKitty"); }
</script>
<p>
<input id="Button1" type="button" value="Click" onclick="return Button1_onclick()" />
</p>
当你点击Button1的时候,你就会看到一个WP的对话框弹出来了。
”notification.alert”接收下列参数
- 信息:显示在对话框上的信息。
- callback方法 :当对话框关闭之后执行的函数。
- 对话框标题 :如题
- 对话框按钮名 :如题
比如下面这样的:
function Button1_onclick() { navigator.notification.alert("Welcome",null,"Custom Title","Custom name"); }
看第四个参数,不是你希望的Custom name吧。