ajout d'un script pour taper les mac plus rapidement

This commit is contained in:
Romain Beuque 2013-09-14 16:44:07 +02:00
parent 82f76928e1
commit f549da5dc9
2 changed files with 32 additions and 1 deletions

View File

@ -0,0 +1,30 @@
function mac_address_correcter(event){
var valeur = document.getElementById("mac_adress_input").value;
console.log(document.getElementById("mac_adress_input").value);
var regex = /&/g;
valeur = valeur.replace(regex, "1");
var regex = /é/g;
valeur = valeur.replace(regex, "2");
var regex = /"/g;
valeur = valeur.replace(regex, "3");
var regex = /'/g;
valeur = valeur.replace(regex, "4");
var regex = /\(/g;
valeur = valeur.replace(regex, "5");
var regex = /-/g;
valeur = valeur.replace(regex, "6");
var regex = /è/g;
valeur = valeur.replace(regex, "7");
var regex = /_/g;
valeur = valeur.replace(regex, "8");
var regex = /ç/g;
valeur = valeur.replace(regex, "9");
var regex = /à/g;
valeur = valeur.replace(regex, "0");
if(document.getElementById("mac_adress_input").value != valeur){
document.getElementById("mac_adress_input").value = valeur;
}
var regex = /[^A-Fa-f0-9:]/gi;
if(valeur.search(regex) != -1)
alert("ERREUR");
}

View File

@ -4,6 +4,7 @@
<head>
<link type="text/css" rel="Stylesheet" href="/css/common.css" />
<link type="text/css" rel="Stylesheet" href="/css/show.css" />
<script src="/js/mac_address_changer.js" />
<xi:include href="common-css-header.html" />
</head>
<body>
@ -44,7 +45,7 @@
<div>
<div>
<input type="text" name="first_machine_name" placeholder="nom de la machine" class="item_name"/>
<input type="text" name="first_machine_mac" placeholder="adresse mac" />
<input type="text" name="first_machine_mac" onkeyup="mac_address_correcter()" id="mac_adress_input" placeholder="adresse mac" />
</div>
</div>
</div>