2012-12-27 62 views
2

我有關於我的選項卡的問題。在我包含<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" ></script>之前,這些標籤顯示出來,但是現在這3個表格沒有顯示相應的標籤。當我從ajax.googleapis應用jquery.min.js時,jQuery選項卡沒有顯示

請做檢查以下

我的代碼裏面我的頭標籤:

<link rel="stylesheet" type="text/css" href="css/style.css"> 
<link rel="stylesheet" type="text/css" href="css/userpage.css"> 

<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" media="all" /> 
<script src="http://code.jquery.com/jquery-1.8.3.js"></script> 
<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script> 


<script> 
$(function() { 
    $("#tabs").tabs(); 
}); 
</script> 

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" ></script> 

<script type="text/javascript"> 
     function codeBinsAddEvent(obj,type,fn){ 
      if(obj.attachEvent){ 
        if(type == "load"){ 
         obj.attachEvent('on'+type, fn); 
        } 
        else{ 
         obj.attachEvent('onreadystatechange', fn); 
        } 
        /* 
       obj['e'+type+fn]=fn; 
       obj[type+fn]=function(){ 
        obj['e'+type+fn](window.event)} 
       ;obj.attachEvent('on'+type,obj[type+fn])*/ 
      } 
      else obj.addEventListener(type,fn,false) 
     }; 
     function codeBinsAddLoadEvent(fn){ 
      codeBinsAddEvent(document.addEventListener&&!window.addEventListener?document:window,'load',fn) 
     }; 
     function codeBinsAddReadyEvent(fn){ 
      codeBinsAddEvent(document,'DOMContentLoaded',fn) 
     }; 

    </script> 

而在我的身體標記:

<div id="tabs"> 
    <ul> 
    <li><a href="#tabs-1">Students</a></li> 
    <li><a href="#tabs-2">Subjects/a></li> 
</ul> 
<div id="tabs-1"> 
<table id="mytable" cellspacing="0" summary="Students"> 
<tr> 
<th scope="col" class="nobg"></th> 
<th scope="col" abbr="Name">Name</th> 
<th scope="col" abbr="Address">Address</th> 
<th scope="col" abbr="Level">Level</th> 
<th scope="col" abbr="School">School</th> 
</tr> 
<?php 
// Start looping table row 
while ($row = mysql_fetch_array($result)) { 

     $firstname = $row["Firstname"]; 
      $middlename = $row["Middlename"]; 
      $lastname = $row["Lastname"]; 
      $address = $row["Address"]; 
    $level = $row["LevelName"]; 
    $school = $row["SchoolName"]; 

?> 
<tr> 
<td><input name="checkbox" type="checkbox" /></td> 
<td class="spec"><?php echo $lastname.", ".$firstname. " " .substr($middlename, 0,1) . "." ; ?> </td> 
<td><?php echo $address; ?></td> 
<td><?php echo $level; ?></td> 
<td><?php echo $school; ?></td> 
</tr> 
<?php 
// Exit looping 
} 
?> 
</table> 

</div> <!-- end of tabs1 --> 

<div id="tabs-2"> 

<table id="mytable" cellspacing="0" summary="Subjects"> 
<tr> 
<th scope="col" class="nobg"></th> 
<th scope="col" abbr="Code">Subject Code</th> 
<th scope="col" abbr="Name">Subject Name</th> 
<th scope="col" abbr="Description">Description</th> 
<th scope="col" abbr="Unit">Unit</th> 
</tr> 

<?php 

$result2 = mysql_query($sql); 

if($result2 === FALSE) { 
die(mysql_error()); // TODO: better error handling 
} 

// Start looping table row 
while ($row2 = mysql_fetch_array($result2)) { 

     $code = $row2["Code"]; 
    $Name = $row2["Name"]; 
    $description = $row2["Description"]; 
      $unit = $row2["Unit"]; 

?> 

<tr> 
<td><input name="checkbox" type="checkbox"/></td> 
<td class="spec"><?php echo $code; ?> </td> 
<td><?php echo $name; ?></td> 
<td><?php echo $description; ?></td> 
<td><?php echo $unit; ?></td> 
</tr> 

<?php 
// Exit looping 
} 

?> 

</table> 

</div> <!-- end of tabs2 --> 

當我加入這個:

<script type="text/javascript"> 
     function codeBinsAddEvent(obj,type,fn){ 
      if(obj.attachEvent){ 
        if(type == "load"){ 
         obj.attachEvent('on'+type, fn); 
        } 
        else{ 
         obj.attachEvent('onreadystatechange', fn); 
        } 
        /* 
       obj['e'+type+fn]=fn; 
       obj[type+fn]=function(){ 
        obj['e'+type+fn](window.event)} 
       ;obj.attachEvent('on'+type,obj[type+fn])*/ 
      } 
      else obj.addEventListener(type,fn,false) 
     }; 
     function codeBinsAddLoadEvent(fn){ 
      codeBinsAddEvent(document.addEventListener&&!window.addEventListener?document:window,'load',fn) 
     }; 
     function codeBinsAddReadyEvent(fn){ 
      codeBinsAddEvent(document,'DOMContentLoaded',fn) 
     }; 

    </script> 

它不允許顯示選項卡。怎麼了?請幫忙謝謝。

+2

爲什麼你要這個**的jQuery/1.7.2 **爲您正在使用jQuery的**/** 1.8.3哦 – Jai

回答

1

你正在包含jQuery兩次,因此在第二個include中,jQuery UI標籤被刪除。

刪除此行:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" ></script> 

如果你想包括一個縮小的版本中改變第一URL這樣:

http://code.jquery.com/jquery-1.8.3.min.js 
+0

感謝!我的錯 –

1

你想的jQuery使用多個版本,這導致錯誤。

,如果你想使用縮小的版本去

<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.3.min.js" ></script> 
相關問題