Curs Javascript

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.

Alege data dorita


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>

2. In document HTML, in locatia unde doriti sa aveti formularul pentru acest script, adaugati urmatorul cod.
<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>

Un Test simplu in fiecare zi

HTML
CSS
JavaScript
PHP-MySQL
Engleza
Spaniola
Care tag este element de tip bloc?
<div> <img> <span>
<div>Web Programming and Development</div>
Care cod CSS afiseaza textul subliniat?
font-style: italic; text-decoration: underline; font-weight: 500;
h2 {
  text-decoration: underline;
}
Clic pe functia JavaScript care apeleaza o alta functie dupa un anumit timp.
insertBefore() setTimeout() querySelector()
function someFunction() { alert("CoursesWeb.net"); }
setTimeout("someFunction()", 2000);
Clic pe instructiunea care returneaza numarul total de elemente dintr-un array asociativ.
count($array) count($array, 1) strlen()
$food =["fruits" =>["banana", "mar"), "veggie" =>["ceapa", "rosie"));
$nr_food = count($food, 1);
echo $nr_food;       // 6
Indicati Viitorul Perfect la negativ al verbului din paranteze, in propozitia: "The child (to not play) by Sunday".
has't played haven't been playing will haven't played
The child will haven't played by Sunday.
- Copilul nu s-ar fi jucat pana duminica.
Indicati Viitorul Perfect pentru verbul "contar" (a povesti) la forma "Él".
habrá contado va a contar contaba
Él no habrá contado el cuento.
- El nu ar fi spus povestea.
Aflati ziua din saptamana

Last accessed pages

  1. I sau Me (8305)
  2. Gramatica limbii spaniole. Indrumator si prezentare generala (67839)
  3. Participiu trecut (4009)
  4. Ser - Estar 2 (3350)
  5. Text colorat (771)

Popular pages this month

  1. Cursuri si Tutoriale: Engleza, Spaniola, HTML, CSS, Php-Mysql, JavaScript, Ajax (788)
  2. Exercitii engleza - English Tests and exercises - Grammar (354)
  3. Coduri pt culori (340)
  4. Gramatica limbii engleze - Prezentare Generala (327)
  5. Cursuri limba engleza gratuite si lectii online (321)