Una cosa di questo tipo? Immagino che stai usando anche php.

codice:
<script>
<!--
function verifica_codice()
{
var correct = true;
if (!document.righe.codiceprodotto.value.match(/^[0-9]{9,}$/)){
correct = false; 
window.open("pagina.php?Var=<?php $_post['variabile']?>","","width=512, height=288");
}
return correct;
}
//-->
</script>
ciao