jquery脚本链接是bug?

时间:2015-10-15 17:46:12

标签: javascript php jquery html

当我在index.php

中插入此脚本链接时



<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
&#13;
&#13;
&#13;

它变成了这个..

enter image description here

这是正常的样子,应该看起来像

enter image description here

这里是整个代码

&#13;
&#13;
<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>
		<?php include ('title.php');?>
	</title>
	
   	<link rel="icon" href="assets/img/LOGO.png">	

	<link href="assets/css/bootstrap.css" rel="stylesheet">	
	<link href="assets/css/bootstrap.min.css" rel="stylesheet">
	<link href="assets/css/plugins/metisMenu/metisMenu.min.css" rel="stylesheet">
	<link href="assets/css/custom.css" rel="stylesheet">
	<link href="assets/font-awesome-4.1.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">
	<link href="assets/css/jquery.dataTables.min.css" rel="stylesheet" type="text/css">
	<link rel="stylesheet" href="/resources/demos/style.css">
	<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
	
	</head>
<body>
	<div id="wrapper">
		<?php 
			session_start();	
			include ("checkSession.php");
			include ("nav.php");
			include ("pagecontent.php");
		?>
	</div>
	

	
	<script src="assets/js/jquery.js"></script>
    <script src="assets/js/bootstrap.min.js"></script>
    <script src="assets/js/plugins/metisMenu/metisMenu.min.js"></script>
    <script src="assets/js/custom.js"></script>
    <script src="assets/js/jquery.dataTables.min.js"></script>
	<script src="assets/js/jquery-1.3.2.min"></script>
	
	<script>
		$(document).ready(function(){
			$('#listTable').DataTable();
		});
	</script>
	<script>
		$(document).ready(function(){
			$('#print').DataTable({
        "paging":   false,
        "filter": false,
        "info":     false
    } );
		});
	</script>
	<script language="javascript">
	function Clickheretoprint()
	{ 
	  var disp_setting="toolbar=yes,location=no,directories=yes,menubar=yes,"; 
		  disp_setting+="scrollbars=yes,width=1000, height=400, left=100, top=25"; 
	  var content_vlue = document.getElementById("content").innerHTML; 
	  
	  var docprint=window.open("","",disp_setting); 
	   docprint.document.open(); 
	   docprint.document.write('</head><body onLoad="self.print()" style="width: 1500px; font-size:11px; font-family:arial; font-weight:normal;">');          
	   docprint.document.write(content_vlue); 
	   docprint.document.close(); 
	   docprint.focus(); 
	}


	</script>
  <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
	<script>
  $(function() {
    $( "#from" ).datepicker({
      defaultDate: "+1w",
      changeMonth: true,
      numberOfMonths: 1,
      onClose: function( selectedDate ) {
        $( "#to" ).datepicker( "option", "minDate", selectedDate );
      }
    });
    $( "#to" ).datepicker({
      defaultDate: "+1w",
      changeMonth: true,
      numberOfMonths: 1,
      onClose: function( selectedDate ) {
        $( "#from" ).datepicker( "option", "maxDate", selectedDate );
      }
    });
  });
  </script>
  </script>

	




</body>

</html>
&#13;
&#13;
&#13;

那么如果我删除脚本链接并输入其他源代码,它不起作用,所以我真的需要该脚本链接来运行该功能:(

3 个答案:

答案 0 :(得分:3)

你有两倍(实际上,三倍)包含jQuery。

<script src="assets/js/jquery.js"></script>
<script src="assets/js/jquery-1.3.2.min"></script>
<script src="//code.jquery.com/jquery-1.10.2.js"></script>

jQuery 1.3.2兼容代码中的某些内容可能无法在jQuery 1.10.2中工作(最后加载的版本会覆盖其他版本)。检查控制台是否有脚本错误。

您可以使用jQuery.noConflict在页面上使用多个版本的jQuery,但最好还是解决更基本的问题。

答案 1 :(得分:0)

我现在知道了,我只需将其编辑成

&#13;
&#13;
<script src="assets/js/jquery-1.10.2.js"></script>
<script src="assets/js/jquery-ui.js"></script>
&#13;
&#13;
&#13;

答案 2 :(得分:-2)

我相信它是因为用于访问jquery的CDN的协议。试试这个:

<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>

如果不起作用,请尝试使用HTTPS:

<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>