在页面加载或点击发生之前,窗口会弹出什么?JQUERY移动

what does the window pop before the pages even loads or the tap happens? JQUERY MOBILE

本文关键字:窗口 什么 移动 JQUERY 加载      更新时间:2023-09-26

页面完全加载并且按钮未被事件触摸之前弹出"呼叫2062710041"。代码有什么问题?

 <!DOCTYPE html>
 <html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>home</title>
    <link rel="stylesheet" href="themes/style.min.css" />
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2      /jquery.mobile.structure-1.3.2.min.css" />
    <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script> <script>
        $('#phone').on( 'tap',"#phone",goto());{
         function goto(event){
        window.location = 'tel:2062710041'}};
    </script>
</head>    
<body>
    <div data-role="page" data-theme="a">
<div data-role="header" data-position="inline" >
      <div class="leftstyle">  <img src="message.gif" width="40" height="39"></div>
        <div class="rightstyle"> <img src="call.gif" id="phone" width="40" height="39">   </div>
 <div class="center">    <img src="LOGO.png" width="209" height="210" >  </div>

使用下面的此方法将允许您等到页面加载后再在其中执行任何操作。这是jQuery的就绪函数。

$(document).ready(function() { /* your code. */ });

在jQuery之外的相同过程。

document.onload = function(){ /* your code. */ };

使用 jquery 的 ready() 函数在满载时绑定水龙头。尝试:

$(document).ready(function () {/*your code*/})

你还有几个额外的{}括号

$('#phone').on('click', function(event){
    event.preventDefault();
    if(event.handled !== true)
    {
        location.href = 'tel:2062710041';
        event.handled = true;
    }
    return false;
 });`