Javascript PHP Jquery选项卡:内容加载到一个选项卡中';s小组
感谢所有能帮忙的人! 我有下面的代码,发生的是三个日历被绘制在一个选项卡上,而不是每个日历被绘制到它们自己的选项卡上。我使用easy tabs jquery插件作为参考Javascript PHP Jquery选项卡:内容加载到一个选项卡中';s小组,javascript,php,jquery,Javascript,Php,Jquery,感谢所有能帮忙的人! 我有下面的代码,发生的是三个日历被绘制在一个选项卡上,而不是每个日历被绘制到它们自己的选项卡上。我使用easy tabs jquery插件作为参考 <?php if(!function_exists('draw_calendar')){ function draw_calendar($month,$year,$day1,$lTaught1,$tutorid,$stuEmail,$timeStart,$timeEnd,$cost,$date,$
<?php
if(!function_exists('draw_calendar')){
function draw_calendar($month,$year,$day1,$lTaught1,$tutorid,$stuEmail,$timeStart,$timeEnd,$cost,$date,$count1){
switch($lTaught1){
case "eng":
$language = "English";
break;
case "oth":
$language = "Other";
break;
case "chi":
$language = "Chinese";
break;
};
if($count1 ==2){
echo"helo";
}
/* draw table */
$calendar = '<div id="tabs'.$count1.'-html"><div id="calendar-wrapper">';
/* table headings */
$calendar.= '<div id="weekday"><ul>
<li>Sunday</li>
<li>Moday</li>
<li>Tuesday</li>
<li>Wednesday</li>
<li>Thursday</li>
<li>Friday</li>
<li>Saturday</li>
</ul></div><div id="calendar">';
/* days and weeks vars now ... */
$running_day = date('w',mktime(0,0,0,$month,1,$year));
$days_in_month = date('t',mktime(0,0,0,$month,1,$year));
$days_in_this_week = 1;
$day_counter = 0;
$dates_array = array();
/* row for week one */
$calendar.= '<ul class="days">';
/* print "blank" days until the first of the current week */
for($x = 0; $x < $running_day; $x++):
$calendar.= '<li class="day other-month"></li>';
$days_in_this_week++;
endfor;
/* keep going with days.... */
for($list_day = 1; $list_day <= $days_in_month; $list_day++):
/* add in the day number */
if($day1 == $list_day && $status="available"){
$calendar.= '<li class="day">';
$calendar .= '<div class="date">'.$list_day.'</div>';
$calendar .= '<div class="event"><a href="registerSession.php?tutorid='.$tutorid.'&email='.$stuEmail.'×tart='.$timeStart.'&timeend='.$timeEnd.'&cost='.$cost.'&date='.$date.'">Book this</a></div>';
} else {
$calendar.= '<li class="day">';
$calendar.= '<div class="date">'.$list_day.'</div>';
}
$calendar.= '</li>';
if($running_day == 6):
$calendar.= '</ul>';
if(($day_counter+1) != $days_in_month):
$calendar.= '<ul class="days">';
endif;
$running_day = -1;
$days_in_this_week = 0;
endif;
$days_in_this_week++; $running_day++; $day_counter++;
endfor;
/* finish the rest of the days in the week */
if($days_in_this_week < 8):
for($x = 1; $x <= (8 - $days_in_this_week); $x++):
$calendar.= '<li class="day other-month"></li>';
endfor;
endif;
/* final row */
$calendar.= '</ul>';
/* end the table */
$calendar.= '</div></div>';
/* all done, return result */
return $calendar;
}
}
?>
好的,所以我不确定如何回答我自己的问题,但我找到了答案,所以其他人在这个问题上绊倒了,来吧
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
</head>
<body>
<div class="container12">
<?php include "nav.php"; ?>
</div>
<div class="wrapper">
<div id="tabs">
<?php
$sql2 = "SELECT timeStart, timeEnd, dateFor, languageTaught, cost, status FROM tutorslots WHERE tutorid='$tutorid'";
include('calendar/calendar.php');
$result2 = mysqli_query($conn,$sql2);
if (!$result2) {
echo 'MySQL Error: ' . mysqli_error();
exit;
}
$result3 = mysqli_query($conn,$sql2);
if (!$result3) {
echo 'MySQL Error: ' . mysqli_error();
exit;
}
echo "<ul>";
$count = 0;
while ($row3 = mysqli_fetch_assoc($result3)) {
$count++;
echo '<li><a href="#tab-'.$count.'"><span>Time Slot</span></a></li>';
}
echo "</ul>";
$count1 = 0;
while ($row2 = mysqli_fetch_assoc($result2)) {
$count1++;
$timeStart = $row2["timeStart"];
$timeEnd = $row2["timeEnd"];
$date = $row2["dateFor"];
$languageTaught = $row2["languageTaught"];
$status = $row2["status"];
$cost = $row2["cost"];
$dateElements = explode('-', $date);
$year1 = $dateElements[0];
$mo = $dateElements[1];
$day1 = $dateElements[2];
$lTaught1 = $languageTaught;
echo '<div id="tab-'.$count1.'">';
echo draw_calendar($mo,$year1,$day1,$lTaught1,$tutorid,$stuEmail,$timeStart,$timeEnd,$cost,$date);
echo '</div>';
}
?>
<br>
</div>
</div>
<div clas="container12">
<?php include('footer.php'); ?>
</div>
<script type="text/javascript">
$(document).ready(function() {
$("#tabs").tabs();
});
</script>
';
}
回声“”;
$count1=0;
而($row2=mysqli\u fetch\u assoc($result2)){
$count1++;
$timeStart=$row2[“timeStart”];
$TIMEND=$row2[“TIMEND”];
$date=$row2[“dateFor”];
$LanguageTeached=$row2[“LanguageTeached”];
$status=$row2[“status”];
$cost=$row2[“成本”];
$dateElements=分解('-',$date);
$year1=$dateElements[0];
$mo=$dateElements[1];
$day1=$dateElements[2];
$lTaught1=$languageteached;
回声';
echo draw_日历($mo、$year1、$day1、$lTaught1、$tutorid、$stuEmail、$timeStart、$timeEnd、$cost、$date);
回声';
}
?>
$(文档).ready(函数(){
$(“#制表符”).tabs();
});
基本上,我不需要对draw_calendar函数做任何操作,我所需要的只是正确的代码,可以是这样:
<html>
<head>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
</head>
<body>
<div id="tabs">
<ul>
<li><a href="#tab-1"><span>Patient Information</span></a></li>
<li><a href="#tab-2"><span>Medical History</span></a></li>
</ul>
<div id="tab-1">
<?php include('calendar.php');
echo draw_calendar(8,2016,04,eng,40,email,1,1,1,03-8-2016);
?>
</div>
<div id="tab-2">
<?php include('calendar.php');
echo draw_calendar(9,2016,04,eng,40,email,1,1,1,03-8-2016);
?>
</div>
<script type="text/javascript">
$(document).ready(function() {
$("#tabs").tabs();
});
</script>
</body>
</html>
$(文档).ready(函数(){
$(“#制表符”).tabs();
});
好的,所以我不确定如何回答我自己的问题,但我找到了答案,所以其他人在这个问题上绊倒了,来吧
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
</head>
<body>
<div class="container12">
<?php include "nav.php"; ?>
</div>
<div class="wrapper">
<div id="tabs">
<?php
$sql2 = "SELECT timeStart, timeEnd, dateFor, languageTaught, cost, status FROM tutorslots WHERE tutorid='$tutorid'";
include('calendar/calendar.php');
$result2 = mysqli_query($conn,$sql2);
if (!$result2) {
echo 'MySQL Error: ' . mysqli_error();
exit;
}
$result3 = mysqli_query($conn,$sql2);
if (!$result3) {
echo 'MySQL Error: ' . mysqli_error();
exit;
}
echo "<ul>";
$count = 0;
while ($row3 = mysqli_fetch_assoc($result3)) {
$count++;
echo '<li><a href="#tab-'.$count.'"><span>Time Slot</span></a></li>';
}
echo "</ul>";
$count1 = 0;
while ($row2 = mysqli_fetch_assoc($result2)) {
$count1++;
$timeStart = $row2["timeStart"];
$timeEnd = $row2["timeEnd"];
$date = $row2["dateFor"];
$languageTaught = $row2["languageTaught"];
$status = $row2["status"];
$cost = $row2["cost"];
$dateElements = explode('-', $date);
$year1 = $dateElements[0];
$mo = $dateElements[1];
$day1 = $dateElements[2];
$lTaught1 = $languageTaught;
echo '<div id="tab-'.$count1.'">';
echo draw_calendar($mo,$year1,$day1,$lTaught1,$tutorid,$stuEmail,$timeStart,$timeEnd,$cost,$date);
echo '</div>';
}
?>
<br>
</div>
</div>
<div clas="container12">
<?php include('footer.php'); ?>
</div>
<script type="text/javascript">
$(document).ready(function() {
$("#tabs").tabs();
});
</script>
';
}
回声“”;
$count1=0;
而($row2=mysqli\u fetch\u assoc($result2)){
$count1++;
$timeStart=$row2[“timeStart”];
$TIMEND=$row2[“TIMEND”];
$date=$row2[“dateFor”];
$LanguageTeached=$row2[“LanguageTeached”];
$status=$row2[“status”];
$cost=$row2[“成本”];
$dateElements=分解('-',$date);
$year1=$dateElements[0];
$mo=$dateElements[1];
$day1=$dateElements[2];
$lTaught1=$languageteached;
回声';
echo draw_日历($mo、$year1、$day1、$lTaught1、$tutorid、$stuEmail、$timeStart、$timeEnd、$cost、$date);
回声';
}
?>
$(文档).ready(函数(){
$(“#制表符”).tabs();
});
基本上,我不需要对draw_calendar函数做任何操作,我所需要的只是正确的代码,可以是这样:
<html>
<head>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
</head>
<body>
<div id="tabs">
<ul>
<li><a href="#tab-1"><span>Patient Information</span></a></li>
<li><a href="#tab-2"><span>Medical History</span></a></li>
</ul>
<div id="tab-1">
<?php include('calendar.php');
echo draw_calendar(8,2016,04,eng,40,email,1,1,1,03-8-2016);
?>
</div>
<div id="tab-2">
<?php include('calendar.php');
echo draw_calendar(9,2016,04,eng,40,email,1,1,1,03-8-2016);
?>
</div>
<script type="text/javascript">
$(document).ready(function() {
$("#tabs").tabs();
});
</script>
</body>
</html>
$(文档).ready(函数(){
$(“#制表符”).tabs();
});
include('calendar/calendar.php')是上面一节中具有完整绘制日历()函数的代码。include('calendar/calendar.php')是上面一节中具有完整绘制日历()函数的代码。