Skip to content

Instantly share code, notes, and snippets.

@facumartig
Created July 13, 2013 20:22
Show Gist options
  • Save facumartig/5992087 to your computer and use it in GitHub Desktop.
Save facumartig/5992087 to your computer and use it in GitHub Desktop.
calendario
<?php include 'php/functions.php'; ?>
<!DOCTYPE html>
<html>
<head>
<title>Calendario</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="css/style.css" rel="stylesheet" media="screen">
<script src="js/jquery.js"></script>
<script>
$(document).ready(function() {
var day = $("#day").val(),
month = $("#month").val(),
year = $("#year").val();
var tbody = $("tbody");
tbody.load("php/date.php?d=" + month + "/" + day + "/" + year);
$("select#mes").change(function (){
tbody.load("php/date.php?d=" + $(this).val() + "/" + day + "/" + year);
$(this).attr("selected", true);
})
})
</script>
</head>
<body>
<input type="hidden" id="month" value="<?php echo $actual_m; ?>" />
<input type="hidden" id="day" value="<?php echo $actual_d; ?>" />
<input type="hidden" id="year" value="<?php echo $actual_y; ?>" />
<h1 class="text-center">Calendario</h1>
<div class="container">
<table class="table table-bordered">
<thead>
<tr>
<th><script> document.write($("#year").val()); </script></th>
<th colspan="5"></th>
<th class="mes">
<select id="mes">
<?php
for ($i = 1; $i <= 12; $i++){
echo "<option value=".$i.">".$mes[$i]."</option>";
}
?>
</select>
</th>
</tr>
<tr class="info">
<th>Lunes</th>
<th>Martes</th>
<th>Miércoles</th>
<th>Jueves</th>
<th>Viernes</th>
<th>Sábado</th>
<th>Domingo</th>
</tr>
</thead>
<tbody>
<tr>
<?php
for ($i = 1; $i <= $days_number; $i++) {
echo "<td>".$i."</td>";
if ($i % 7 == 0){
echo "</tr><tr>";
}
}
?>
</tr>
</tbody>
</table>
</div>
<script src="js/bootstrap.min.js"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment