Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

IE ou XP me bloque mon script DHTML ??!!

2 réponses
Avatar
Bon plan
Sous certaines version de IE sous XP, le system affiche un message comme
quoi un script pouvant etre malveillant a été bloqué.

Du coup mon menu est statique ...

Oh, biensur, on peut cliquer sur l'alerte pour autoriser le script ... Mais
je pense que les utilisateurs n'auront pas envie de se risquer ...

Que pouvez vous me conseiller pour mon menu ???

Merci de vos conseils :)

<html><head>
<SCRIPT language=JScript>
function ShowHide(Div) {
if (Div.style.display=='none') {
Div.style.display='InLine';
}
else {
Div.style.display='none';
}
}
</SCRIPT>

</head>
<body>


<table style="border-top-width:1px; border-right-width:1px;
border-bottom-width:0px; border-left-width:1px;
border-color:rgb(153,153,153); border-top-style:solid;
border-right-style:solid; border-bottom-style:none;
border-left-style:solid;" cellpadding="5" cellspacing="0" bgcolor="#CCCCCC"
bordercolordark="white" bordercolorlight="black">
<tr>
<td width="150">
<p style="line-height:100%; margin-top:0;
margin-bottom:0;">titre
<a href="#" OnClick="javascript: ShowHide(menu1);">menu
1</a></p>
</td>
</tr>
</table>

<DIV id='menu1' style=display=InLine;>

<table style="line-height:100%; margin-top:0; margin-bottom:0;
border-top-width:1px; border-right-width:1px; border-bottom-width:0px;
border-left-width:1px; border-color:rgb(153,153,153);
border-top-style:solid; border-right-style:solid; border-bottom-style:none;
border-left-style:solid;" cellpadding="5" cellspacing="0" bgcolor="#F9F9F9">
<tr>
<td width="150" style="border-bottom-width:1px;
border-bottom-color:rgb(153,153,153); border-bottom-style:solid;">
<p style="line-height:100%; margin-top:0; margin-bottom:0;
margin-left:20;">sous menu 1</p>
</td>
</tr>
<tr>
<td width="150" style="border-bottom-width:1px;
border-bottom-color:rgb(153,153,153); border-bottom-style:solid;">
<p style="line-height:100%; margin-top:0; margin-bottom:0;
margin-left:20;">sous menu 2</p>
</td>
</tr>
<tr>
<td width="150">
<p style="line-height:100%; margin-top:0; margin-bottom:0;
margin-left:20;">sous menu 3</p>
</td>
</tr>
</table>

</div>

<table style="border-width:1px; border-color:rgb(153,153,153);
border-style:solid;" cellpadding="5" cellspacing="0" bgcolor="#CCCCCC"
bordercolordark="white" bordercolorlight="black">
<tr>
<td width="150">
<p style="line-height:100%; margin-top:0;
margin-bottom:0;">titre
<a href="#" OnClick="javascript: ShowHide(menu2);">menu
2</a></p>
</td>
</tr>
</table>

<DIV id='menu2' style=display=none;>

<table style="line-height:100%; margin-top:0; margin-bottom:0;
border-top-width:0px; border-right-width:1px; border-bottom-width:1px;
border-left-width:1px; border-color:rgb(153,153,153); border-top-style:none;
border-right-style:solid; border-bottom-style:solid;
border-left-style:solid;" cellpadding="5" cellspacing="0" bgcolor="#F9F9F9">
<tr>
<td width="150" style="border-bottom-width:1px;
border-bottom-color:rgb(153,153,153); border-bottom-style:solid;">
<p style="line-height:100%; margin-top:0; margin-bottom:0;
margin-left:20;">sous menu 1</p>
</td>
</tr>
<tr>
<td width="150" style="border-bottom-width:1px;
border-bottom-color:rgb(153,153,153); border-bottom-style:solid;">
<p style="line-height:100%; margin-top:0; margin-bottom:0;
margin-left:20;">sous menu 2</p>
</td>
</tr>
<tr>
<td width="150">
<p style="line-height:100%; margin-top:0; margin-bottom:0;
margin-left:20;">sous menu 3</p>
</td>
</tr>
</table>

</div>

<table style="border-top-width:0px; border-right-width:1px;
border-bottom-width:1px; border-left-width:1px;
border-color:rgb(153,153,153); border-top-style:none;
border-right-style:solid; border-bottom-style:solid;
border-left-style:solid;" cellpadding="5" cellspacing="0" bgcolor="#CCCCCC"
bordercolordark="white" bordercolorlight="black">
<tr>
<td width="150">
<p style="line-height:100%; margin-top:0;
margin-bottom:0;">titre
<a href="#" OnClick="javascript: ShowHide(menu3);">menu
3</a></p>
</td>
</tr>
</table>

<DIV id='menu3' style=display=none;>

<table style="line-height:100%; margin-top:0; margin-bottom:0;
border-top-width:0px; border-right-width:1px; border-bottom-width:1px;
border-left-width:1px; border-color:rgb(153,153,153); border-top-style:none;
border-right-style:solid; border-bottom-style:solid;
border-left-style:solid;" cellpadding="5" cellspacing="0" bgcolor="#F9F9F9">
<tr>
<td width="150" style="border-bottom-width:1px;
border-bottom-color:rgb(153,153,153); border-bottom-style:solid;">
<p style="line-height:100%; margin-top:0; margin-bottom:0;
margin-left:20;">sous menu 1</p>
</td>
</tr>
<tr>
<td width="150" style="border-bottom-width:1px;
border-bottom-color:rgb(153,153,153); border-bottom-style:solid;">
<p style="line-height:100%; margin-top:0; margin-bottom:0;
margin-left:20;">sous menu 2</p>
</td>
</tr>
<tr>
<td width="150">
<p style="line-height:100%; margin-top:0; margin-bottom:0;
margin-left:20;">sous menu 3</p>
</td>
</tr>
</table>

</div>

</body>

</html>

2 réponses

Avatar
Thibaut Allender
Sous certaines version de IE sous XP, le system affiche un message comme
quoi un script pouvant etre malveillant a été bloqué.


ca pourrait être le cas en local, mais même pas, je viens de tester sous
XP SP2.

Que pouvez vous me conseiller pour mon menu ???

<html><head>
<SCRIPT language=JScript>


bof, préférer <script type="text/javascript">


function ShowHide(Div) {
if (Div.style.display=='none') {


bof, plutôt utiliser le DOM :

document.getElementById(Div).style.display == 'none'
même syntaxe pour le reste

Div.style.display='InLine';


InLine n'est pas une valeur correcte
de plus, un <div> sera plutôt de type block que inline

<DIV id='menu1' style=display=InLine;>


il manque les guillemets, c'est ":" et pas "="

<table style="line-height:100%; margin-top:0; margin-bottom:0;
border-top-width:1px; border-right-width:1px; border-bottom-width:0px;
border-left-width:1px; border-color:rgb(153,153,153);
border-top-style:solid; border-right-style:solid; border-bottom-style:none;
border-left-style:solid;" cellpadding="5" cellspacing="0" bgcolor="#F9F9F9">


mon dieu... utilise une css externe et les notions condensées, c'est le
souk là...
et pourquoi des tables à une seule cellule par ligne, encore en plus
dans des div ?

une liste me parait plus adaptée... elle peut même être imbriquée pour
représenter au mieux l'idée de hiérarchie du menu:

<ul>
<li>titre menu 1<ul id="menu1"><li>sous menu 1</li><li>sous menu
2</li><li>sous menu 3</li></ul></li>
<li>titre menu 2<ul id="menu2"><li>sous menu 1</li><li>sous menu
2</li><li>sous menu 3</li></ul></li>
<li>titre menu 3<ul id="menu3"><li>sous menu 1</li><li>sous menu
2</li><li>sous menu 3</li></ul></li>
</ul>

le code html se limite à peu de choses près à ça, tout le reste est géré
en JS + CSS
on passe de 150 lignes de code à... 5 !

a+

--
thibaut allender | http://capsule.org | http://photo.capsule.org

Avatar
Bon plan
Merci, t'es conseils vont m'etre précieux :)

Sympa d'avoir prix le temps de me répondre :)

Que la force soit avec toi maître Yoda

Je reste en communication :) Cette semaine, je verai a reposter :)

NB : Oui, les feuilles de style interne, c'est laid :)
Mais j'ai trop été interloqué que mon menu se bloque ...

Allé ++