Bonjour,
J'aimerais inclure des fichiers javascripts en javascript, j'ai trouvé deux fonctions, qu'en pensez-vous ?
Merci
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 function include(file) { if (window.document.getElementsByTagName) { script = window.document.createElement("script"); script.type = "text/javascript"; script.src = file; Body = window.document.getElementsByTagName("BODY"); if (Body) { Body[0].appendChild(Script); } } } function include(url) { var head = window.document.getElementsByTagName('head')[0]; var script = window.document.createElement('script'); script.setAttribute('src', url); script.setAttribute('type', 'text/javascript'); head.appendChild(script); }
++
Partager