1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Document sans titre</title>
<script type="text/javascript">
<!--
function add_evenement(id_obj,evenement,color)
{
function backg(event)
{
var target = event.target || event.srcElement;
target.style.backgroundColor = color;
if (event.preventDefault)
{
event.preventDefault();
}
event.returnValue = false;
}
if (id_obj.addEventListener)
{
id_obj.addEventListener(evenement, backg, false);
}
else if (id_obj.attachEvent)
{
id_obj.attachEvent("on"+evenement+"", backg);
}
}
function background ()
{
var tab_background = background.arguments;
var tab_back_length = tab_background.length;
var id_obj = null;
for (i=0;i<tab_back_length;i++)
{
if (id_obj = document.getElementById(tab_background[i]))
{
add_evenement(id_obj,'mouseover','gray');
add_evenement(id_obj,'mouseout','darkgray');
}
}
}
function aclic()
{
background ('testXD','test4','azerty','testM','testU','testJ','test7');
}
-->
</script>
</head>
<body>
<div>
<a href = "#" onclick = "aclic()" >click</a>
</div>
<div id = "test4" style="margin-top:2em">dfvdfvdfvd</div>
<div id = "testM" style="margin-top:2em">dfvdfvdfvd</div>
<div id = "testU" style="margin-top:2em">dfvdfvdfvd</div>
<div id = "testJ" style="margin-top:2em">dfvdfvdfvd</div>
<div id = "test7" style="margin-top:2em">dfvdfvdfvd</div>
<div id = "testXD" style="margin-top:2em">dfvdfvdfvd</div>
<div id = "azerty" style="margin-top:2em">dfvdfvdfvd</div>
</body>
</html> |
Partager