Cu acest script puteti afla ziua din saptamana corespunzatoare oricarei date cuprinse intre 1900 si 2050
Puteti testa acest script in exemplul de mai jos.
Pentru a adauga acest script intr-o pagina web:
1. Adaugati in documentul HTML, in sectiunea HEAD, urmatorul script.
<script type="text/javascript">
<!--
// Script gratuit
var month = new Array("Ianuarie", "Februarie", "Martie", "Aprilie", "Mai", "Iunie", "Iulie", "August", "Septembrie", "Octombrie", "Noiembrie", "Decembrie");
var startyear = "1900"; // Primul an care poate fi ales
var endyear = "2050"; // Ultimul an care poate fi ales
function ziua() {
var month = document.datazilei.ziluna.options[document.datazilei.ziluna.selectedIndex].value;
var day = document.datazilei.nrzi.options[document.datazilei.nrzi.selectedIndex].value;
var year = document.datazilei.birthyear.options[document.datazilei.birthyear.selectedIndex].value;
var nrzi = new Date(year,month,day);
var ziua = nrzi.getDay();
var weekday = new Array("Duminica", "Luni", "Marti", "Miercuri", "Joi", "Vineri", "Sambata");
alert("Data corespunde zilei de " + weekday[ziua]);
}
//-->
</script>
<form name="datazilei">
<div align="center"><center><table bgcolor="#fefefe" border="2" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3" align="center"><font face="verdana, arial" size="-1">Alege data dorita</font></td>
</tr>
<tr>
<td align="center">
<select name="ziluna" size="1">
<script type="text/javascript">
for(var i=0;i<month.length;i++)
document.write("<option value="+i+">"+month[i]+"</option>");
</script>
</select></td>
<td align="center">
<select name="nrzi" size="1">
<script type="text/javascript">
for(var j=1;j<32;j++)
document.write("<option value="+j+">"+j+"</option>");
</script>
</select></td>
<td align="center">
<select name="birthyear" size="1">
<script type="text/javascript">
for(var k=startyear;k<endyear;k++)
document.write("<option value="+k+">"+k+"</option>");
</script>
</select></td>
</tr>
</table>
</center></div><div align="center"><center><br>
<input value="Afla ziua" onclick="ziua()" type="button">
</center></div>
</form>
<img src="http://coursesweb.net/imgs/webcourses.gif" width="191" height="63" alt="Courses-Web" />
#id { display: none; }
for(var i = 0; i< 8; i++) { if(i > 1) break; alert(i); }
define("CONSTANT_NAME", "value"); echo CONSTANT_NAME;
This school has three classes. - Scoala asta are trei clase.
Escuché dos voces. - Am auzit doua voci.