Besoin d'aide pour un script JS

Besoin d'aide pour un script JS - HTML/CSS - Programmation

Marsh Posté le 25-01-2008 à 15:22:58    

Bonjour,
 
J'ai créé un page html avec ce code :
 

Code :
  1. <SCRIPT language=javascript>
  2. function TJSExtraireParam() {
  3.  url = window.location.href;
  4.  var exp=new RegExp("[&?]+","g" );
  5.  var exp2=new RegExp("[=]+","g" );
  6.  var tabNom=url.split(exp);
  7.  var tabParam=new Array();
  8.  if (tabNom!=null) {
  9.   for (var i=1;i<tabNom.length;i++){
  10.    var tabTemp=tabNom[i].split(exp2);
  11.    tabParam[tabTemp[0]]=tabTemp[1];
  12.   }
  13.  }
  14.  return tabParam;
  15. }
  16. var urlParam = TJSExtraireParam();
  17. </SCRIPT>


 
Il me permet de passer des paramètres de l'adresse au corps de la page web comme ceci :
 

Code :
  1. http://mon-site.com/page?id=PARAMETRE


 
Tout marche correctement sauf que si PARAMETRE contient un ?, ça ne marche pas...  :??:
 
Y'a t il un moyen de contourner cela ?
 
Merci d'avance !
 
 

Reply

Marsh Posté le 25-01-2008 à 15:22:58   

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed