| Pluda 2005-12-26, 10:33 pm |
| Hello,
I'm trying to make a nice blog header, but I now realise that blogspot.com
doesn't allow php...
I want to transform my nice PHP code to javascript... can this be done?
The goal is to have 7 td background images randomly positioned without
repetition...
here is my PHP code:
<?php
function random_array($min, $max, $num) {
$range = 1+$max-$min;
if($num > $range) {
return false;
}
$ret = Array();
while(count($ret) < $num) {
$a = "1";
do {
$a = rand($min, $max);
} while(in_array( $a, $ret));
$ret[] = $a;
}
return $ret;
}
$_SESSION['pix_array'] = random_array(1, 7, 7);
$locpic = $_SESSION['pix_array'];
?>
Thanks!
|