如何解决javascripts链接之间的冲突

时间:2017-02-01 18:26:44

标签: javascript jquery css

当页面中存在这些链接 A 导致页面 B 中的实施javascript时出现问题时,这可能很少会遇到任何问题。 如果我在页面B之前访问了页面A,我就无法使用Enter键在字段之间移动。在访问页面A之后,我在css中获得了一些vbles。 我无法删除脚本链接,因为查询不适用于没有第A页中的这两个链接的模态显示

第A页

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"> </script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<?php
include_once("config.php");

 if (isset($_GET['id'])) {
 $search_Query = "SELECT * FROM mydate WHERE id='1' ";
 $order_no = $_REQUEST['id'];
 $date = $_REQUEST['date'];
 $search_Result = mysqli_query($conn, $search_Query);

   if($search_Result)
   {
    if(mysqli_num_rows($search_Result))
    {
        while($row = mysqli_fetch_array($search_Result))
        {
  $conn->query("UPDATE `mydate` SET `order_no` = '$order_no',`order_date` = '$date'") or die('Error: ' . mysqli_error($conn));}}}
   }


 ?>
<div id="myModal" class="modal-dialog">
<button  class = "btn btn-success" ><span class = "glyphicon glyphicon-ok">  </span> Done</button>
  </div>    

第B页:

<head>


    <meta name = "viewport" content = "width=device-width, initial-scale=1" />

    <link rel = "stylesheet" href = "css/bootstrap.css" />
    <link rel = "stylesheet" href = "css/bootstrap.min.css" />
    <link rel = "stylesheet" href = "css/jquery.dataTables.css" />
     <link rel="stylesheet" href="jquery.ui.timepicker.css?v=0.3.3" type="text/css" />
 <link rel="stylesheet" href="include/ui-1.10.0/ui-lightness/jquery-ui-1.10.0.custom.min.css" type="text/css" />
 <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">

  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">


<script src = "js/jquery.js"></script>
<script src = "js/bootstrap.js"></script>
<script src = "js/jquery.dataTables.js"></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 type="text/javascript" src="include/ui-1.10.0/jquery.ui.core.min.js"></script>
<script type="text/javascript" src="include/ui-1.10.0/jquery.ui.widget.min.js"></script>
<script type="text/javascript" src="include/ui-1.10.0/jquery.ui.tabs.min.js"></script>
<script type="text/javascript" src="include/ui-1.10.0/jquery.ui.position.min.js"></script>
<script type="text/javascript" src="jquery.ui.timepicker.js?v=0.3.3"> </script>
<script type = "text/javascript">
$(function () {
 var focusedElement;
$(document).on('focus', 'input', function () {

            if (focusedElement == this) return; 

            focusedElement = this;

            setTimeout(function () { focusedElement.select(); }, 5); 
           });  });

      jQuery.extend(jQuery.expr[':'], {

      focusable: function (el, index, selector) {

    return $(el).is('a, button, :input, [tabindex]');
     }
    });

    $(document).on('keydown', ':focusable', function (e) {


   if (e.which == 13) {

    if(!($(this).prop('nodeName')=="BUTTON"))
   e.preventDefault(); 
     $(document).ready(function () {
    $("#phone").blur(function () {
    var phone = $(this).val();
   if (phone == '') {}
   else{

    $.ajax({
      url: "validation.php?phonenumber="+phone

    }).done(
    function (data) {
  obj = JSON.parse(data);
   if (obj) {

   } });   
   } });  });

    var $canfocus = $(':focusable');

    var index = $canfocus.index(this) + 1;

    if (index >= $canfocus.length) index = 0;

    $canfocus.eq(index).focus();
   } });
  </script>



 <script>
 $(function() {
 $("#orderdatepicker").datepicker({
dateFormat: "mm-dd-yy",
}).datepicker("setDate", new Date());
});

</script>

1 个答案:

答案 0 :(得分:0)

刚刚用

替换了第A页中的两个javascript链接
<script src = "js/jquery.js"></script>
<script src = "js/bootstrap.js"></script>

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