Originariamente inviato da Al_katraz984
Grazie tante.. Lo chiedevo al forum javascript se mi serviva in javascript...

a me serve col PHP..
Il problema è che per fare quello che vuoi fare devi per forza fare una richiesta al server mentre il pulsante è in locale. Quindi devi fare una combinazione di entrambi.
Ecco uno spunto.

codice:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Untitled</title>
<script language="JavaScript" type="text/javascript">
<!--
var myRandValue=0;
function rand(anId) {
  window.open("test3003b.php","","top=0,left=0,width=0,height=0,status=no");
  document.getElementById(anId).value = myRandValue;
} // function rand(anId) 
//-->
</script>


</head>
<body>
<input type="text" id="rrr">
<input type="button" value="alea" onclick="rand('rrr')">
</body>
</html>
File : test3003b.php
codice:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Untitled</title>
</head>
<body>
<script language="JavaScript" type="text/javascript">
<!--
window.opener.myRandValue = <?php print rand(1, 6); ?>;
window.close();
//-->
</script>

</body>
</html>