Skip welcome & menu and move to editor
Load cached copy from
 
<!doctype html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Convertisseur</title>
</head>
<body onload="init()">
  <p id="date"></p>
  <h3>Convertir un entier en binaire et en hexadécimal</h3>
  <p>Entier à convertir : <input type="text" size="5" id="entier" maxlength="5"></p>
  <p>Cette page permet de convertir un entier en binaire ou en hexadécimal.</p>
  <p>Convertir en :
    <input type="radio" name="choix" id="binaire"> binaire
    <input type="radio" name="choix" id="hexa"> hexadécimal
    <input type="button" onclick="Calcul()" value="Convertir">
  </p>
  <p>Résultat : <input type="text" size="10" id="resultat" disabled="disabled"></p>
</body>
</html>
 
function init() {
  document.getElementById("date").innerHTML = Date();
}
function Calcul() {
  entier = Number(document.getElementById("entier").value);
  if (document.getElementById("binaire").checked) {
    let nbBinaire = entier.toString(2);
    document.getElementById("resultat").value = nbBinaire;
  }
}
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x