簡體   English   中英

Visual Studio 2015 RC Cordova應用程序(Windows Phone Universal,“警報”未定義)

[英]Visual Studio 2015 RC Cordova App (Windows Phone Universal, “alert” undefined)

我有一個基本的Cordova應用程序,實際上是Visual Studio 2015 RC的默認模板。 以下內容不適用於Index.html,我只添加了一個帶有onclick事件的按鈕,

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>OMFG</title>

    <!-- OMFG references -->
    <link href="css/index.css" rel="stylesheet" />
</head>
<body>
    <p>Hello, your application is ready!</p>

    <!-- Cordova reference, this is added to your app when it's built. -->
    <script src="cordova.js"></script>
    <script src="scripts/platformOverrides.js"></script>

    <script src="scripts/index.js"></script>

    <button onclick="alert('foobar!');">Do Stuff!</button>
</body>
</html>

我懂了

0x800a1391-JavaScript運行時錯誤:“警報”未定義

知道發生了什么事嗎?

我在第一次使用VS 2015年同樣的問題, alert在手機上不工作-你只需要更換它notification.alert 不要忘記添加通知插件。

這是我使用的一個示例,它可以完美運行:

navigator.notification.alert(
   'Authentification réussi !', // message
   'Authentification réussi !', // title
   'Authentification'           // buttonName
);  

您不能僅僅發現自己必須使用它,

(new Windows.UI.Popups.MessageDialog("Content", "Title")).showAsync().done();

我的錯!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM