問題があります。スクリプトは機能しますが、「未定義」が返されます。誰でも理由を知っていますか?
<div id="balise"></div>
<a href="ty.html">Telecharger</a>
<img src="aaa.png" id="mypic" alt="aa" />
<script>
var OSName='',
eight='windowseight.png',
vista ='windowsvista.png',
xp ='windowsxp.png';
if (navigator.userAgent.indexOf("Windows NT 6.2")!=-1) {OSName="Windows 8"+document.getElementById('mypic').setAttribute('src',eight)};
if (navigator.userAgent.indexOf("Windows NT 6.1")!=-1) {OSName="Windows 7"+document.getElementById('mypic').setAttribute('src','windowseven.png')};
if (navigator.userAgent.indexOf("Windows NT 6.0")!=-1) {OSName="Windows Visa"+document.getElementById('mypic').setAttribute('src',vista)};
if (navigator.userAgent.indexOf("Windows NT 5.1")!=-1) {OSName="Windows xp"+document.getElementById('mypic').setAttribute('src',windowsxp)};
document.getElementById("balise").innerHTML = OSName;
</script>