未应用jQuery移动规则

未应用jQuery移动规则,jquery,jsp,jquery-mobile,Jquery,Jsp,Jquery Mobile,这是我的index.jsp文件,但是jQuery移动CSS和JS不起作用 My.css和.js文件与index.jsp处于相同的目录级别。它们应该在不同的目录中吗?这是我的目录结构 这是我的index.jsp: <html> <head> <link rel="stylesheet" type="text/css" href="jquery.mobile-1.0a4.1.css" /> <script type

这是我的index.jsp文件,但是jQuery移动CSS和JS不起作用

My.css和.js文件与index.jsp处于相同的目录级别。它们应该在不同的目录中吗?这是我的目录结构

这是我的index.jsp:

<html>
    <head>
        <link rel="stylesheet" type="text/css" href="jquery.mobile-1.0a4.1.css" />
        <script type="text/javascript" src="jquery.mobile-1.0a4.1.js"></script>
    </head>
    <body>
        <div data-role="fieldcontain">
            <label for="slider">Input slider:</label>
            <input type="range" name="slider" id="slider" value="0" min="0" max="100"  />
        </div>
    </body>
</html>

输入滑块:
Firebug说这两种资源都已加载


emmm您需要将它们包含在文件头中:

    <link rel="stylesheet" type="text/css" href="something.css" />
<script type='text/javascript' src='something.js'></script>

emmm您需要将它们包含在文件头中:

    <link rel="stylesheet" type="text/css" href="something.css" />
<script type='text/javascript' src='something.js'></script>

也需要加载。下载它,将它放在同一个文件夹中,并在加载jQuery mobile之前添加以下行

<script type="text/javascript" src="jquery.js"></script>

也需要加载。下载它,将它放在同一个文件夹中,并在加载jQuery mobile之前添加以下行

<script type="text/javascript" src="jquery.js"></script>

您的页面远离所示的参考页面结构

在您的正文之后,您的字段应包含以下内容:

<div data-role="page">
... your content in the body
</div>

... 你的内容在身体里

您的页面远离所示的参考页面结构

在您的正文之后,您的字段应包含以下内容:

<div data-role="page">
... your content in the body
</div>

... 你的内容在身体里

您需要在内容周围添加a data role=“page”标记,并添加jQuery框架

<html>
    <head>
        <link rel="stylesheet" type="text/css" href="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.css" />
        <script type="text/javascript" src="http://code.jquery.com/jquery-1.5.min.js"></script>
        <script type="text/javascript" src="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js"></script>
    </head>
    <body>
        <div data-role="page">
            <div data-role="fieldcontain">
                <label for="slider">Input slider:</label>
                <input type="range" name="slider" id="slider" value="0" min="0" max="100"  />
            </div>
        </div>
    </body>
</html>

输入滑块:

您需要在内容周围添加a data role=“page”标记,并添加jQuery框架

<html>
    <head>
        <link rel="stylesheet" type="text/css" href="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.css" />
        <script type="text/javascript" src="http://code.jquery.com/jquery-1.5.min.js"></script>
        <script type="text/javascript" src="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js"></script>
    </head>
    <body>
        <div data-role="page">
            <div data-role="fieldcontain">
                <label for="slider">Input slider:</label>
                <input type="range" name="slider" id="slider" value="0" min="0" max="100"  />
            </div>
        </div>
    </body>
</html>

输入滑块:

在使用jquery mobile和jsp时,需要确保您使用的是cdn路径

    <link rel="stylesheet" type="text/css" href="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.css" />
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.5.min.js"></script>
    <script type="text/javascript" src="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js"></script>

在使用jquery mobile和jsp时,需要确保您使用的是cdn路径

    <link rel="stylesheet" type="text/css" href="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.css" />
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.5.min.js"></script>
    <script type="text/javascript" src="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js"></script>


什么是“未加载”?使用网络流量监视器(例如Chrome开发者工具或Firebug内置的)。是否需要资源?他们返回的状态码是什么?内容是否符合您的期望?你的服务器日志怎么说?我说的“未加载”是指没有引用js和.css文件。HTML源代码在我看来很好。跟随@David的评论。浏览器是否正在请求这些文件?你能直接加载JS和CSS文件吗(通过在浏览器的URL栏中键入URL)?这有帮助吗?如何检查是否使用firebug请求了资源?什么是“未加载”?使用网络流量监视器(例如Chrome开发者工具或Firebug内置的)。是否需要资源?他们返回的状态码是什么?内容是否符合您的期望?你的服务器日志怎么说?我说的“未加载”是指没有引用js和.css文件。HTML源代码在我看来很好。跟随@David的评论。浏览器是否正在请求这些文件?你能直接加载JS和CSS文件吗(通过在浏览器的URL栏中键入URL)?这有帮助吗?如何使用firebug检查是否正在请求资源?@user470,用您的filenames@user470,只需将
某些内容
替换为您的文件名即可。谢谢,尝试了该操作,但现在页面上没有显示任何字段。我尝试了jQuery版本jQuery-1.5.2.js和jQuery-1.6.1.js,但在jQuery移动文档如何正确使用它的过程中得到了相同的结果。显然,您的
数据
属性不正确或有问题。谢谢,尝试过了,但现在页面上没有显示任何字段。我尝试了jQuery版本jQuery-1.5.2.js和jQuery-1.6.1.js,但在jQuery移动文档如何正确使用它的过程中得到了相同的结果。显然,您的
数据
属性不正确或有问题。