我是个初学者,我有一个很容易解决的问题。然而,在研究了许多论坛并尝试了技术解决方案之后,我无法使代码脱机工作,但它确实可以很好地在线加载JQuery。现在让我开始解释我的工作。在
我用Flask创建了一个应用程序,这样我就可以使用智能手机应用程序或navigator(Raspberry本地主机)操作一个检查机器人。我写了两个代码,Python服务器和HTML客户端。它在网上运行得很好,获取JQuery库如下所示:
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
现在我想让它离线工作,我尝试了很多其他问题在这个网站上给出的解决方案,但我无法使它发挥作用。 我尝试下载JQuery并将其放在同一个文件夹中并在代码中引用它,但没有成功。这就是我想的。在
我确保把相同的名称和文件夹,尝试子文件夹,有或没有“/”,但没有任何工作。在
目前,我也在使用在线css(用于图像),但我在测试离线JQuery时也尝试将其删除。我只想让JQuery离线工作,这样我就可以完成页面了。在
再说一次,我是个新手,所以我先向你道歉并感谢你的帮助。在
这是一个完整的HTML文件,它有一些葡萄牙语,但它们并不重要,因为问题只是在本地加载Jquery。再次感谢大家的关注。在
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<!doctype html>
<html>
<head>
<meta name="viewport" content="initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css">
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
</head>
<style>
h3 {text-align: left;}
span {font-weight: bold;}
</style>
<script type=text/javascript>
$(
// Ao pressionamento de um botão, realizar um pedido ajax para o servidor realizando a determinada função
function()
{
$('#frente').click(function()
{
$.getJSON('/_frente');
});
$('#re').click(function()
{
$.getJSON('/_re');
});
$('#esquerda').click(function()
{
$.getJSON('/_esquerda');
});
$('#direita').click(function()
{
$.getJSON('/_direita');
});
$('#verticalcima').click(function()
{
$.getJSON('/_verticalcima');
});
$('#verticalbaixo').click(function()
{
$.getJSON('/_verticalbaixo');
});
$('#posinit').click(function()
{
$.getJSON('/_posinit');
});
$('#azimuteesquerda').click(function()
{
$.getJSON('/_azimuteesquerda');
});
$('#azimutedireita').click(function()
{
$.getJSON('/_azimutedireita');
});
$('#d').click(function()
{
$.getJSON('/_distancia', function(data)
{
$("#distaprox").text(data.distaprox);
});
});
}
);
</script>
<!-- Uma simples pagina JQuery Mobile para realizar o controle remoto do sistema robotico de inspeção -->
<body>
<div data-role="header">
<div><h3>ELMO CRSEA IFF</h3></div>
</div>
<div style="width:400px;;">
<form>
<div id="float1" style="width:200px;float:left;">
<p> Direcional:</p>
<p> 
<button type="button" name="frente" id="frente" style="font-size:40px"><i class="fa fa-arrow-up"></i></button>
</p>
<p> <button type="button" name="esquerda" id="esquerda" style="font-size:40px"><i class="fa fa-arrow-left"></i></button>
   
<button type="button" name="direita" id="direita" style="font-size:40px"><i class="fa fa-arrow-right"></i></button>
</p>
<p>
<button type="button" name="re" id="re" style="font-size:40px"><i class="fa fa-arrow-down"></i></button>
</p>
</div>
<div id="float2" style="200px;float:left;">
<p> Câmera:</p>
<button type="button" name="verticalcima" id="verticalcima" style="font-size:40px"><i class="fa fa-toggle-up"></i></button>
</p>
<button type="button" name="azimuteesquerda" id="azimuteesquerda" style="font-size:40px"><i class="fa fa-toggle-left"></i></button>
<button type="button" id="posinit" name="posinit" style="height:50px;width:50px;font-size:15px">Inicial<i</i></button>
<button type="button" name="azimutedireita" id="azimutedireita" style="font-size:40px"><i class="fa fa-toggle-right"></i></button>
</p>
<p>  
<button type="button" name="verticalbaixo" id="verticalbaixo" style="font-size:40px"><i class="fa fa-toggle-down"></i></button></p>
</div>
<p>
<button type="button" id="d" name="d" style="height:50px;width:50px;font-size:15px">Medir<i</i></button>
Distância aproximada = <span id="distaprox"></span>cm</p>
</form>
</div>
<footer>
<p><h3>Copyright 2016 IBL</h3></p>
</footer>
</body>
</html>
尝试创建一个静态文件夹,该文件夹将承载所有js和其他静态文件,如下所示:
现在,将
^{pr2}$jquery
文件放入js/
文件夹,并在模板中使用以下内容:在模板中,您将拥有:
相关问题 更多 >
编程相关推荐