OVH Cloud OVH Cloud

Problème avec (JavaScript)

2 réponses
Avatar
Mickaël
Bonjour :)
J'ai un problème avec ce script :
window.onload = function() {
m = document.createElement("map");
m.setAttribute("name","abc");

a = document.createElement("area");
a.setAttribute("shape","rect");
a.setAttribute("coords","0,0,50,50");
a.setAttribute("href","/123");

m.appendChild(a);

document.body.appendChild(m);

i = document.createElement("img");
i.setAttribute("src","http://www.google.com/images/logo.gif");
i.setAttribute("usemap","#abc");

document.body.appendChild(i);
};

Il marche avec Firefox et Opera mais pas Internet Explorer.

Une idée ?

Merci :D

2 réponses

Avatar
westindian
Bonjour

Essaie ce code (affine le car c un premier jet) :

window.onload = function() {
m = document.createElement("<map NAME='abc'>");
a = document.createElement("<area shape='rect' coords='0,0,50,50'
href='123'></map>") ;
m.appendChild(a);

document.body.appendChild(m);

i = document.createElement("<img
src='http://www.google.com/images/logo.gif' usemap='#abc'/>");
document.body.appendChild(i);
};


@+

WestIndian


"Mickaël" wrote in message
news:e%
Bonjour :)
J'ai un problème avec ce script :
window.onload = function() {
m = document.createElement("map");
m.setAttribute("name","abc");

a = document.createElement("area");
a.setAttribute("shape","rect");
a.setAttribute("coords","0,0,50,50");
a.setAttribute("href","/123");

m.appendChild(a);

document.body.appendChild(m);

i = document.createElement("img");
i.setAttribute("src","http://www.google.com/images/logo.gif");
i.setAttribute("usemap","#abc");

document.body.appendChild(i);
};

Il marche avec Firefox et Opera mais pas Internet Explorer.

Une idée ?

Merci :D


Avatar
westindian
Bonjour

Essaie ce code (affine le car c un premier jet) :

window.onload = function() {

m = document.createElement("<map NAME='abc'>");

a = document.createElement("<area shape='rect' coords='0,0,50,50'
href='123'></map>") ;

m.appendChild(a);

document.body.appendChild(m);

i = document.createElement("<img src='http://www.google.com/images/logo.gif'
usemap='#abc'/>");

document.body.appendChild(i);

};

@+

WestIndian

"Mickaël" wrote in message
news:e%
Bonjour :)
J'ai un problème avec ce script :
window.onload = function() {
m = document.createElement("map");
m.setAttribute("name","abc");

a = document.createElement("area");
a.setAttribute("shape","rect");
a.setAttribute("coords","0,0,50,50");
a.setAttribute("href","/123");

m.appendChild(a);

document.body.appendChild(m);

i = document.createElement("img");
i.setAttribute("src","http://www.google.com/images/logo.gif");
i.setAttribute("usemap","#abc");

document.body.appendChild(i);
};

Il marche avec Firefox et Opera mais pas Internet Explorer.

Une idée ?

Merci :D