Js onclick='function';
kiko
-
kiko -
kiko -
Bonjour,
je ne comprends pas pourquoi ce code ne passe pas :
var body = document.getElementsByTagName('body')[0],
p = document.cretateElement('p'),
p1 = document.cretateElement('p'),
input = document.createElement('input'),
input1 = document.createElement('input');
input.onclick='da';
input1.onclick='da';
p.appendChild(input);
body.appendChild(p);
p1.appendChild(input1);
body.appendChild(p1);
function da(){alert('ok')}
je ne comprends pas pourquoi ce code ne passe pas :
var body = document.getElementsByTagName('body')[0],
p = document.cretateElement('p'),
p1 = document.cretateElement('p'),
input = document.createElement('input'),
input1 = document.createElement('input');
input.onclick='da';
input1.onclick='da';
p.appendChild(input);
body.appendChild(p);
p1.appendChild(input1);
body.appendChild(p1);
function da(){alert('ok')}
3 réponses
-
Bonjour
Ce ne serait pas
p = document.createElement('p'),
p1 = document.createElement('p'),
au lieu de
p = document.cretateElement('p'),
p1 = document.cretateElement('p'),
-
-
je ne comprends pas pourquoi ce code ne passe pas voici le bon code juste :
var body = document.getElementsByTagName('body')[0],
p = document.createElement('p'),
p1 = document.createElement('p'),
input = document.createElement('input'),
input1 = document.createElement('input');
input.onclick='da';
input1.onclick='da';
p.appendChild(input);
body.appendChild(p);
p1.appendChild(input1);
body.appendChild(p1);
function da(){alert('ok')}