Switch case et variable URL comme en PHP
Bonjour, je réalise un site web en asp, j'ai une variable qui passe dans l'URL mapage.asp?menu=contact
Je voudrais que selon la variable passé, j'en ai 3 (contact, zone et société) cela me charge un include en centrale de ma page.
Voici mon script actuel :
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
|
<% menu= Request.Querystring("menu") + ""
If menu = "" Then
Response.Redirect("index.asp")
End If
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//fr" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
</head>
<body style="background:#ffffff">
<!-- #include file="menu.inc.asp"-->
<br><br>
<!-- Récupération de la variable menu -->
Ma variable passée dans l'URL est : <%=menu%>
<table align="center" width="1000px" height="100%" border="0">
<tr width="100%">
<td align="center" colspan="3"><h2><u><%=titre%></u></h2></td>
</tr>
<tr width="100%" height="100%">
<td width="200px" rowspan="2">
<img src="images/ecs.gif" alt="Eau chaude sanitaire" title="Eau chaude sanitaire"><br><br>
<img src="images/inverter.gif" alt="Inverter" title="Réversible"><br><br>
<img src="images/piscine.gif" alt="Piscine" title="Chauffage piscine">
</td>
<td width="300px" height="50%" valign="middle" align="center">
<%
switch (menu) {
case "contact" :%>
<!-- #include file="inclus/contact.inc.asp" -->
<% break;
case "societe" :%>
<!-- #include file="inclus/societe.inc.asp" -->
<% break;
case "zone" :%>
<!-- #include file="inclus/zone.inc.asp" -->
<%break;
default :%>
<!-- #include file="inclus/zone.inc.asp" -->
<%}%>
</td>
</tr>
</table>
</body>
</html> |
Le soucis est que j'ai l'erreur suivante qui apparait a chaque fois :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| Erreur de compilation Microsoft VBScript error '800a0401'
Fin d'instruction attendue
/iisHelp/common/500-100.asp, line 11
Dim objASPError, blnErrorWritten, strServername, strServerIP, strRemoteIP Dim strMethod, lngPos, datNow, strQueryString, strURL
--------------------------------------------------------------------------^
Erreur de compilation Microsoft VBScript error '800a0408'
Caractère incorrect
/chauff2/contact.asp, line 29
switch (menu) {
--------------^ |
Alors qu'il me récupère bien la variable dans l'url car elle s'affiche bien au début de mon code.
Merci de votre aide.