Home  >  Article  >  Web Front-end  >  Detailed explanation of phonegap implementation prompt operation

Detailed explanation of phonegap implementation prompt operation

php中世界最好的语言
php中世界最好的语言Original
2018-03-26 15:00:111240browse

This time I will bring you a detailed explanation of the phonegap prompt operation. What are the precautions for phonegap to implement the prompt operation. The following is a practical case, let's take a look.

There are often four ways:

<!DOCTYPE html> 
<html> 
  
    <head> 
        <meta charset="UTF-8"> 
        <title>Notifications</title> 
  
        <script type="text/javascript" charset="UTF-8" src="cordova.js"></script> 
        <script type="text/javascript" charset="UTF-8"> 
          document.addEventListener("deviceready", onDeviceReady, false); 
            function onDeviceReady() { 
                checkConnection(); 
            } 
              
            //显示自定义的警告 
            function showAlert(){ 
                navigator.notification.alert('Game Over!',alertCallback,'Game Over!','Done'); 
            } 
            //警告的回调 
            function alertCallback(){ 
                  
            } 
              
            //显示一个自定义的确认对话框 
            function showConfirm(){ 
                navigator.notification.confirm('Game Over!',onConfirm,'Game Over!','Restart,Exit'); 
            } 
            //确认对话框的回调 
            function onConfirm(button){ 
                alert('You selected button '+button); 
            } 
              
            //鸣叫两次 
            function playBeep(){ 
                navigator.notification.beep(2); 
            } 
              
            //振动 
            function vibrate(){ 
                navigator.notification.vibrate(4000); 
            } 
              
        </script> 
    </head> 
  
    <body onload="onLoad()"> 
        <p><a href="#" onclick="showAlert(); return false;">Show Alert</a></p> 
        <p><a href="#" onclick="showConfirm(); return false;">Show Confirmation</a></p> 
        <p><a href="#" onclick="playBeep() return false;">Play Beep</a></p> 
        <p><a href="#" onclick="vibrate() return false;">Vibrate</a></p> 
    </body> 
  
</html>

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to php Chinese Other related articles online!

Recommended reading:

Detailed explanation of creating contacts with phonegap

How to change the code of the current url without refreshing

The above is the detailed content of Detailed explanation of phonegap implementation prompt operation. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn