<input type="text" id="inp">
<button id="btn">GO</button>
<script>
var loc = {
'123456':'http://site.ru/str1',
'098765':'http://site.ru/str2',
'654321':'http://site.ru/str3'
};
btn.onclick = function() {
if(inp.value.length >= 12 ) location = loc[inp.value.substr(0,6)]||'http://site.ru/default';
};
</script>