The property l.livreobj is undefined below. Why?
function livre() {
i=i+1;
var cd = document.getElementById("act").value.substr(0,3)+"-"+i;
var isbn = document.getElementById("isbn").value;
var act = document.getElementById("act").value;
var titre = document.getElementById("titre").value;
var livreobj ={
Cd:cd,
Isbn:isbn,
Act:act,
Titre:titre
};
}
function add() {
var l = new livre();
alert("kjkj");
ajoutertable(l.livreobj);
}
HTML:
<body>
code : <input type="text" id="cd" disabled/>
isbn : <input type="text" id="isbn"/>
Acteur : <input type="text" id="act"/>
Titre : <input type="text" id="titre"/>
<input type="button" id="ajt" value="Ajouter" onclick="add();"/>
<table border id = "myTable">
<tr>
<td>
Code</td>
<td>
ISBN</td>
<td>
Auteur</td>
<td>
Titre</td>
<td>
Action</td>
</tr>
</table>