[javascript]Onclick & button

Salut a tous,
voila je voudrait choisir d'ouvrir des pages html grace a des boutons mais je seche un peu si quelqu'un sait comment on s'y prend son aide ne sera pas de refus!
voila j'avais pensé a quequechose du style:

dans un fichier accesadmin.html:
<html>
  <head>
    <title>acces administrateur</title>
    <script language="javascript" type="text/javascript" src="Fonctions.js"></script>
  </head>
  <body>
    <h3><center>que voulez vous modifier?<br></center></h3>
    <a onClick="choix(name)"><center>
        <input type="button" name="truc" value="truc">
        <input type="button" name="bidule" value="bidule">
    </center></a>
  </body>
</html>

et dans un fichier Fonctions.js:
function choix(nom){
  if    (nom == 'truc') windows.open("creatruc.html","_self");
  else  (nom == 'bidule') windows.open("creabidule.html","_self");
}

mais bon bien entendu ça ne marche pas :(
si quelqu'un voit des erreurs ou si quelqu'un a une solution je l'en remercie
Tchô!!! ;-)

4 réponses

  1. Et si tu faisais tout simplement :
    <body>
        <h3><center>que voulez vous modifier?<br></center></h3>
        <center>
            <input type="button" onClick="location.replace('creatruc.html');" value="truc">
            <input type="button" onClick="location.replace('creabidule.html');"  value="bidule">
        </center>
      </body>


    .::: "A trop vouloir feindre de faire fi, on finit 
    par faire fi de vouloir feindre." 
    :::.
    1. Essaie quelque chose comme çà :
        <body>
          <h3><center>que voulez vous modifier?<br></center></h3>
          <center>
              <input type="button" onClick="choix('creatruc.html')" value="truc">
              <input type="button" onClick="choix('creabidule.html')"  value="bidule">
          </center>
        </body>

      avec :
      function choix(nom){
        windows.open(nom,"_self");
      }