1<html>
2<head>
3
4<script>
5function executer_script(monscript) {
6 var head = document.getElementsByTagName("head")[0];
7 var scr;
8
9 var d = document.getElementById('resultat');
10 d.innerHTML = monscript;
11 var scrajx = d.getElementsByTagName('script');
12
13 for(var i in scrajx) {
14 scr = document.createElement("script");
15 scr.type = "text/javascript";
16 scr.text = scrajx[i].text;
17 head.appendChild(scr);
18 }
19}
20</script>
21
22</head>
23<body>
24
25<input type="button" value="test" onclick="executer_script('Mon html + du javascript <script>alert(\'test\');</script>');">
26
27<div id="resultat"></div>
28
29</body>
30</html>
31