vishesh
Nearly a Posting Virtuoso
1,381 posts since Oct 2006
Reputation Points: 85
Solved Threads: 42
Food for thought ... here's a completely different approach:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style>
</style>
<script type='text/javascript'>
onload = function(){
var macFields = document.getElementById("macFields");
var mac_ = macFields.getElementsByTagName("input");
function writeMacToHidden(){
var m = [];
for(var i=0; i<mac_.length; i++){
m.push(mac_[i].value);
}
document.forms[0].mac.value = m.join('');
}
function macInput_closure(i){
return function(){
writeMacToHidden();
if(this.value.length == 2) {
var index = (i+1) % mac_.length;
mac_[index].focus();
}
};
}
for(var i=0; i<mac_.length; i++){
mac_[i].onkeyup = macInput_closure(i);
}
}
</script>
</head>
<body>
<form>
<input xtype="hidden" name="mac" size="12"> <i>normally hidden</i>
<br/><br/>
<div id="macFields">
MAC Address: <input class="mac_" size="2" maxlength="2"> : <input class="mac_" size="2" maxlength="2"> : <input class="mac_" size="2" maxlength="2"> : <input class="mac_" size="2" maxlength="2"> : <input class="mac_" size="2" maxlength="2"> : <input class="mac_" size="2" maxlength="2">
</div>
</form>
</body>
</html>
Airshow
Airshow
WiFi Lounge Lizard
2,683 posts since Apr 2009
Reputation Points: 321
Solved Threads: 372
Devinodaniel,
Beware! As I said, it's an "approach", not a solution. In other words, it needs more than the 15 minutes development I needed to prepare the demo.
Try, for example, filling all the fields then tabbing from one to another.
Airshow
Airshow
WiFi Lounge Lizard
2,683 posts since Apr 2009
Reputation Points: 321
Solved Threads: 372
Devinodaniel,
Good luck with it.
Airshow
Airshow
WiFi Lounge Lizard
2,683 posts since Apr 2009
Reputation Points: 321
Solved Threads: 372