la page html:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Nouvelle page 1</title>
<script type='text/javascript'>
function addScript(){
var newScript =document.createElement('script');
newScript.type='text/javascript';
newScript.src="DomScript.js"
document.getElementsByTagName('head')[0].appendChild(newScript)
}
</script>
</head>
<body>
<input type='button' onclick="setTimeout(addScript,1000);this.disabled=true" value='go' />
</body>
</html> |
le fichier .js
document.body.onclick=function(){alert('ajouté')};
Partager