Bonjour,
Voici mon code HTML :
Le probleme est que, quand vous cliquez-droit sur la page, le menu s'affiche (OK), mais avec une ligne en trop (une ligne vierge). Y'a-t-il un moyen de supprimer cette ligne? 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
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 <script language="javascript"> var arg2="" function showMenu() { with(document.getElementById(arg2).style) { visibility = "visible" left = event.x+"px" top = event.y+"px" } return false; } function hideMenu() { with(document.getElementById(arg2).style) { visibility = "hidden" } } contextMenu = new Object() contextMenu.applyStyle = function(arg1) { with(document.getElementById(arg1).style) { borderWidth = "2px" borderStyle = "outset" backgroundColor = "#D4D0C8" fontFamily = "Tahoma" fontSize = "8pt" visibility = "hidden" position = "absolute" } arg2 = arg1 document.oncontextmenu = showMenu document.onclick = hideMenu } contextMenu.newRow = function(nb, val) { document.write("<tr><span id=\"row"+nb+"\" onmouseover=\"this.style.backgroundColor='#0A246A'; this.style.color='white'\" onmouseout=\"this.style.backgroundColor='#D4D0C8'; this.style.color='black'\">"+val+"</span></tr>") } contextMenu.initialize = function (nm) { document.write('<span id="'+nm+'"><table>') } contextMenu.end = function () { document.write("</table></span>") } </script> <body onload="contextMenu.applyStyle('context1')"> <script language="javascript"> contextMenu.initialize("context1") contextMenu.newRow(1,"Hi1") contextMenu.newRow(2,"Hi2") contextMenu.newRow(3,"Hi3") contextMenu.end() </script> </body>
Partager