2016-06-20 65 views
0

我不知道什么是错的。这段代码是正确的,但是当我在本地机器上运行它时,我发现输入字段丢失了!
enter image description here用户界面范围滑块无法正常工作

<!doctype html> 
 
<html lang="en"> 
 
<head> 
 
    <meta charset="utf-8"> 
 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
 
    <title>slider demo</title> 
 
    <link rel="stylesheet" href="//code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css"> 
 
    <script src="//code.jquery.com/jquery-1.10.2.min.js"></script> 
 
    <script src="//code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script> 
 
</head> 
 
<body> 
 
<div data-role="header"> 
 
    <h1>jQuery Mobile Example</h1> 
 
    </div> 
 
    <div role="main" class="ui-content"> 
 
    <label for="slider-0">Input slider:</label> 
 
    <input type="range" name="slider-0" id="slider-0" value="60" min="0" max="100"> 
 
    </div> 
 
</body> 
 
</html>

+0

你有没有按照正确的顺序进口资源? – Rajesh

+1

运行代码段时,我可以看到输入字段。它是否真的导致了你的截图? –

+0

是的,这真的很奇怪! :((( –

回答

0

您需要设置的协议,因为默认的浏览器将设置文件://

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

重要 - 这是一个不好的做法,指定协议,只能在本地机器上使用

+0

它现在的作品非常感谢:)) –

+0

它是一个不好的做法来指定协议。理想情况下,它应该选择你的网站的协议。 – Rajesh

+0

@Rajesh这是事实,但它不会在本地机器上工作。 http://stackoverflow.com/questions/16509740/why-jquery-does-not-work-on-my-home-local-machine – Luka

-1

<!doctype html> 
 
<html lang="en"> 
 
<head> 
 
    <meta charset="utf-8"> 
 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
 
    <title>slider demo</title> 
 
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css"> 
 
    <script src="http://code.jquery.com/jquery-1.10.2.min.js"></script> 
 
    <script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script> 
 
</head> 
 
<body> 
 
<div data-role="header"> 
 
    <h1>jQuery Mobile Example</h1> 
 
    </div> 
 
    <div role="main" class="ui-content"> 
 
    <label for="slider-0">Input slider:</label> 
 
    <input type="range" name="slider-0" id="slider-0" value="60" min="0" max="100"> 
 
    </div> 
 
</body> 
 
</html>

+0

请解释您所做的更改。仅仅放置工作代码是不够的。 – Rajesh

+0

@Rajesh他改变了包括脚本的顺序,正如我在上面回答 – Luka

+0

@Rajesh我使用http协议更正了url。我没有看到有人已经作为我的代码片段被打开来回答它。 –

相关问题