ATTENTION ne déclarez jamais une variable nommée "status"
Bonjour à tous.
Si vous êtes amateur de casse tête je vous en prie, vous allez prendre votre pied!
J'ai une page contenant un ensemble de facture présentées sous forme de tableau.
Je dois réaliser une chose très bête et banale: si je coche une case à cocher à côté de l'intitulé d'une facture, je dois pouvoir lire la cellule "Status" de ce tableau. Ou plus exactement prendre l'information dans un champ de type "hidden".
Inutile de dire que ça fonctionne impeccablement bien sous Firefox et tout autre navigateur moderne.
Mais là où le bas blesse... c'est que:
- ça ne fonctionne pas sur IE si la requête provient du serveur
- ça fonctionne sur IE si de la même page provenant du serveur je fais "afficher la source" > enregistrer dans un fichier .html et que je le lance... :aie:
La seule différence entre les 2? IE m'indique dans la version locale que pour me protéger il a restreint l'exécution des scripts... (blablabla) et je lui donne l'autorisation de supprimer la restriction...
Des petits screenshot valent la peine je pense:
http://www.jer-rebecq.be/ie_serveur.jpg
http://www.jer-rebecq.be/ie_local.jpg
Alors je vous donne la version HTML Locale (sauvée depuis IE):
Code:
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 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script src="/js/jquery-1.2.6.js" type="text/javascript"></script>
<script src="/js/tablecloth.js" type="text/javascript"></script>
<script src="/js/general.js" type="text/javascript"></script>
<!--[if lt IE 8]>
<script src="/js/IE8.js" type="text/javascript"></script>
<![endif]-->
<link rel="stylesheet" media="screen" type="text/css" title="General" href="/css/general.css" />
</head>
<body class="tundra">
<div>
<img src='/img/logo_xxx.jpg' alt='xxx'/><br/><br/>
</div>
<div class="content">
<script type="text/javascript">
var rulesStatus = new Array();
rulesStatus["In Preparation"] = new Array();
rulesStatus["In Preparation"] ["Approved"] = 7;
rulesStatus["In Preparation"] ["Delete"] = 0;
rulesStatus["Approved"] = new Array();
rulesStatus["Approved"] ["Sent"] = 8;
rulesStatus["All"] = new Array();
rulesStatus["All"] ["Sent"] = 8;
rulesStatus["All"] ["Paid"] = 9;
rulesStatus["All"] ["Partial paid"] = 10;
function displayGeneralActions() {
i = 0;
currentCheckbox = document.getElementById('checkboxInvoice_'+i);
currentStatus = '';
isNotPossible = false;
while (currentCheckbox != null) {
if (currentCheckbox.checked == true) {
status = document.getElementById('statusName_'+i).value;
alert(status);
if (currentStatus == '')
currentStatus = status;
if ((status == 'In preparation' && currentStatus != 'In Preparation') || (status == 'Approved' && currentStatus != 'Approved')) {
isNotPossible = true;
i = 0;
break;
}
if (status != 'In preparation' && status != 'Approved')
currentStatus = 'All';
}
i++;
currentCheckbox = document.getElementById('checkboxInvoice_'+i);
}
alert('INFO: '+i+'\nStatus: '+currentStatus+'\n boolean: '+isNotPossible);
/*
TESTER si i=0 => masquer menu else afficher
si aucun checked status est vide!
*/
selection = document.getElementById('selectionGeneralActions');
if (i==0 || currentStatus=='')
selection.style.display = 'none';
else {
selection.style.display = 'block';
}
}
</script>
<select id='filter_0' name='centerFilter' onchange="filterPage('/invoice')">
<option value='all'>All centers</option>
<select id='filter_1' name='companyFilter' onchange="filterPage('/invoice')">
<option value='all'>All companies</option>
<select id='filter_2' name='statusFilter' onchange="filterPage('/invoice')">
<option value='all'>All status</option>
<option value="In Preparation">In Preparation</option><option value="Approved">Approved</option> </select>
<select id='filter_3' name='periodFilter' onchange="filterPage('/invoice')">
<option value='all'>All periods</option>
<option value="2008-09-01 2008-09-30">2008/09/01 - 2008/09/30</option><option value="2008-10-01 2008-10-31">2008/10/01 - 2008/10/31</option><option value="2008-10-02 2008-10-15">2008/10/02 - 2008/10/15</option> </select>
<select id='filter_4' name='numberFilter' onchange="filterPage('/invoice')">
<option value='all'>All numbers</option>
<option value="-">-</option><option value="2008/1">2008/1</option><option value="2008/2">2008/2</option><option value="2008/3">2008/3</option><option value="2008/4">2008/4</option> </select>
<input type='button' value='Remove filters' onclick='document.location.href="/invoice"'>
<div id="overview">
<table class="tableCSS">
<tr>
<th><input type="checkbox" onclick="javascript:controlCheckbox('checkboxInvoice_',this);displayGeneralActions();"/></th>
<th>Center</th>
<th>Number</th>
<th>Company</th>
<th>Period</th>
<th>Due date</th>
<th>Amount</th>
<th>Status</th>
<th>Operation</th>
</tr>
<tr>
<td><input type="checkbox" id="checkboxInvoice_0" name="96" onclick="javascript:displayGeneralActions()"/> </td>
<td><span id="centerName_0">XX</span></td>
<td><span id="invoiceNumber_0">-</span></td>
<td><span id="companyName_0">XX</span></td>
<td><span id="startDate_0">2008/10/01</span> - <span id="endDate_0">2008/10/31</span></td>
<td><span id="dueDate_0">2009/12/30</span></td>
<td><span id="totalPrice_0">295</span></td>
<td>
In Preparation <input type="hidden" id="statusName_0" value="In Preparation" />
</td>
<td>
<a href="/invoice/view?id=96"><img src="/img/view-trans.png"/></a>
<a href="/invoice/edit?id=96"><img src="/img/edit-trans.png"/></a>
<a href="/invoice/delete?id=96"><img src="/img/delete-trans.png"/></a>
<input type="hidden" id="idInvoice_0" value="96"/>
</td>
</tr>
<tr>
<td><input type="checkbox" id="checkboxInvoice_1" name="32" onclick="javascript:displayGeneralActions()"/> </td>
<td><span id="centerName_1">XX</span></td>
<td><span id="invoiceNumber_1">-</span></td>
<td><span id="companyName_1">XX</span></td>
<td><span id="startDate_1">2008/09/01</span> - <span id="endDate_1">2008/09/30</span></td>
<td><span id="dueDate_1">2008/11/30</span></td>
<td><span id="totalPrice_1">340</span></td>
<td>
In Preparation <input type="hidden" id="statusName_1" value="In Preparation" />
</td>
<td>
<a href="/invoice/view?id=32"><img src="/img/view-trans.png"/></a>
<a href="/invoice/edit?id=32"><img src="/img/edit-trans.png"/></a>
<a href="/invoice/delete?id=32"><img src="/img/delete-trans.png"/></a>
<input type="hidden" id="idInvoice_1" value="32"/>
</td>
</tr>
</table>
<div style="height:40px;"></div>
<fieldset id="selectionGeneralActions" class="validationButton" style="display: none;">
<legend>Pour la sélection</legend>
</fieldset>
</div>
</div>
</body>
</html> |
Forcément je ne peux pas vous donner la version envoyée par le serveur mais bon... elle est rigoureusement identique donc... :roll:
Je vous remercie d'avance pour l'aide que vous pourrez me fournir.