Guest User

Untitled

a guest
Nov 12th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. <!doctype html>
  2. <html lang="es">
  3. <head>
  4. <meta charset="utf-8" />
  5. <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
  6. <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
  7. <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
  8. <link rel="stylesheet" href="/resources/demos/style.css" />
  9. </head>
  10. <body>
  11. <input id="datepicker" type="text">
  12. <p class="dia"></p> <!--Se muestra el día seleccionado-->
  13. <p class="precio"></p> <!--Se muestra el precio correspondiente al día-->
  14.  
  15. <script>
  16. $(function() {
  17. $('#datepicker').datepicker({
  18. dateFormat: "DD", // Sólo obtener DD en lugar de " d MM, yy"
  19. onSelect: function (dateText, inst) {
  20. $("p.dia").html( "Día = " + dateText ); // el día de la semana
  21. //hacemos la comparación día/precio
  22. if (dateText == "Monday" || dateText == "Tuesday" || dateText == "Wednesday" || dateText == "Thursday") {
  23. $("p.precio").html( "$3000" );
  24. }else if (dateText == "Friday" || dateText == "Saturday" || dateText == "Sunday") {
  25. $("p.precio").html( "$4000" );
  26. }
  27. }
  28. });
  29. });
  30. </script>
  31. </body>
  32. </html>
Add Comment
Please, Sign In to add comment