Codice sorgente |
||
<SCRIPT language="javascript"> //########################################################################### //## Copyright (C) 2005 Ubaldo Pernigo //## Author Ubaldo Pernigo //## Support can be obtained from author at http://www.pernigo.com //## This program is free software. You can redistribute it and/or modify //## it under the terms of the GNU General Public License as published by //## the Free Software Foundation; either version 2 of the License. //########################################################################### //## date who what //## 20050225 ubi Prima versione per lezione gruppo potenziamento matematica //########################################################################### </script> <script type="text/vbscript"> function adessooraVB() ora = hour(time) minuti = minute(time) msg = " sono le ore " & ora & ":" & minuti if ora < 12 then document.write("Buon giorno!" & msg) else document.write("Buon pomeriggio" & msg) end if end function function adessogiornoVB() d=weekday(date) select case d case 1 document.write("Domenica") case 2 document.write("Lunedì!") case 3 document.write("Martedì!") case 4 document.write("Mercoledì!") case 5 document.write("Giovedì") case 6 document.write("Venerdì!") case else document.write("Sabato") end select end function </script> <SCRIPT language="javascript"> function adessooraJS(){ var d = new Date() var ora = d.getHours() var minuti = d.getMinutes() var msg = " sono le ore " + ora + ":" + minuti if (ora < 12) { document.write("Buon giorno!" + msg) } else { document.write("Buon pomeriggio" + msg) } } function adessogiornoJS(){ var d = new Date() theDay=d.getDay() switch (theDay) { case 1: document.write("Lunedì") break case 2: document.write("Martedì") break case 3: document.write("Mercoledì") break case 4: document.write("Giovedì") break case 5: document.write("Venerdì") break case 6: document.write("Sabato!") break case 0: document.write("Domenica!!") break default: document.write("Ma che giorno è oggi?!") } } </script> </head> <body> <h1>Prova in Javascript</h1> <SCRIPT language="javascript"> adessooraJS(); document.write("<br> Oggi è "); adessogiornoJS(); </script> <hr> <h1>Prova in VBScript</h1> <script type="text/vbscript"> adessooraVB() document.write("<br> Oggi è ") adessogiornoVB() </script> </body> </html>
|