Вот весь мой документ. У меня проблемы с той частью головы, которая начинается с var tabNom1
и в теле после "Partie 2: Affichage du contenu HTML à partir de JavaScript" and before "Partie 3: Affichage et animation des images
"
Я получаю эти ошибки:
Line 58, Column 28: document type does not allow element "ul" here
document.write("<ul>"); Line 58, Column 29: character data is not allowed here
document.write("<ul>"); Line 60, Column 29: character data is not allowed here
document.write("<ul>"); Line 62, Column 53: character data is not allowed here
{document.write("<li>" + tabNom1[x] + "</li>");}
В этом документе:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta content="fr-ca" http-equiv="Content-Language"/>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
<meta http-equiv="content-style-type" content="text/css"/>
<title>TP3</title>
<script type="text/javascript">
function addNumbers()
{
var val1 = parseInt(document.getElementById("Notetp1").value);
var val2 = parseInt(document.getElementById("Notetp2").value);
var val3 = parseInt(document.getElementById("Notetp3").value);
var val4 = parseInt(document.getElementById("Noteexamenintra").value);
var val5 = parseInt(document.getElementById("Noteexamenfinal").value);
var ansD = document.getElementById("Note finale");
ansD.value = val1 + val2 + val3 +val4 + val5;
}
var tabNom1 = {"Nom": "Smith", "Prenom": "John", "CodePermanent": "SMIT23325202", "Login": "Smith" };
</script>
<style type="text/css">
body {font-family:"Times New Roman", Times, serif;}
h2 {font-weight:bold;}
</style>
</head>
<body>
<h2>Partie 1: Formulaire du calcul de la note</h2>
Note tp1 : <input id="Notetp1" name="Note tp1" value="" type="text"/>
Note tp2 : <input id="Notetp2" name="Note tp2" value="" type="text"/>
Note tp3 : <input id="Notetp3" name="Note tp3" value="" type="text"/>
Note examen intra : <input id="Noteexamenintra" name="Note examen intra" value="" type="text"/>
Note examen final : <input id="Noteexamenfinal" name="Note examen final" value="" type="text"/>
<input name="Sumbit" value="Afficher la note finale" onclick="javascript:addNumbers()" type="button"/>
Note final : <input id="Notefinal" name="Note final" value="" type="text"/>
<h2>Partie 2: Affichage du contenu HTML à partir de JavaScript</h2>
<script type="text/javascript">
document.write("<ul>");
document.write("<li>" + "Equipier numéro 1:");
document.write("<ul>");
for (x in tabNom1)
{document.write("<li>" + tabNom1[x] + "</li>");}
document.write("</ul></li></ul>");
</script>
<h2>Partie 3: Affichage et animation des images</h2>
</body></html>