I'm would like to create an object in javascript which prints the number entred but I get this error.
Déclaration d'objet.html:30
Code :
<script type="text/javascript">
// <!--
function Init()
{
var test= new Object;
test.affiche= function()
{
var champ=Number(document.getElementById("champSaisie").value);
alert(Number(champ+4));
};
}
</script>
</head>
<body onload="Init()">
<p><label for="champSaisie">Saisissez un nombre : </label><input type="text" id="champSaisie"></p>
<p><input type="submit" onclick="test.affiche()" value="Effectuer le calcul"></p>
</body></html>