jQuery mobile - DOM Exception 18

jQuery mobile - DOM Exception 18

本文关键字:Exception DOM mobile jQuery      更新时间:2023-09-26

我正在尝试使用jQuery mobile,但似乎还没有开始。

我在本地服务器上托管了以下HMTL文件:

<!DOCTYPE html> 
<html> 
<head> 
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
    <script type="text/javascript" src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script>
</head> 
<body>
</body>
</html>

导致的原因

Javascript错误:未定义SECUIRTY_ERR:DOM异常18

从我的iPhone访问时http://192.168.1.1:8000/mobile.html

在jquery脚本包含标记之前,您是否也链接了CSS样式表文件?

<link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.css" />
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.js"></script>

此外,为了显示页面,您必须将内容包含在容器中,如下所示:

<body>
  <div data-role='page'>
    <div data-role='header'>
    Header goes here
    </div>
    <div data-role='content'>
    Content goes here
    </div>
  </div>
</body>