Hi,
I have this code:
[code=php]<?php
//This is spiraldone.php
Header(“Content-type: image/png”);
$height=8000;
$width=8000;
$im=ImageCreate($width, $height);
[b]$fac=rand(110,130)/100;[/b]
$points=array(0=>0,0,);
while($width>5){
$points[count($points)]=$points[count($points)-2]+round($width/$fac);
$width=round($width/$fac);
$points[count($points)]=$points[count($points)-2];
$points[count($points)]=$points[count($points)-2];
$points[count($points)]=round($width/$fac)+$points[count($points)-2];
$width=round($width/$fac);
$points[count($points)]=$points[count($points)-2]-round($width/$fac);
$width=round($width/$fac);
$points[count($points)]=$points[count($points)-2];
$points[count($points)]=$points[count($points)-2];
$points[count($points)]=$points[count($points)-2]-round($width/$fac);
$width=round($width/$fac);
}
$pointsb=array_reduce($points, “rsum”);
$spia=ImageColorAllocate($im,rand(0,255),rand(0,255),rand(0,255));
$spib=ImageColorAllocate($im,rand(0,255),rand(0,255),rand(0,255));
$spic=ImageColorAllocate($im,rand(0,255),rand(0,255),rand(0,255));
$y=0;
for($x=0;$x+10<count($points);$x+=2){
$cr=array($points[$x],$points[$x+1],$points[$x+2],$points[$x+3],$points[$x+10],$points[$x+11],$points[$x+8],$points[$x+9]);
if($y%3==0){$spi=$spia;}
if($y%3==1){$spi=$spib;}
if($y%3==2){$spi=$spic;}
imagefilledpolygon($im,$cr,4,$spi);
$y++;
}
imagefilledpolygon($im,array($points[6],$points[7],$points[8],$points[9],0,0,0,8000),4,$spic);
imagefilledpolygon($im,array($points[4],$points[5],$points[6],$points[7],0,8000,8000,8000,8000,8000+$points[5]-$points[4]),5,$spib);
imagefilledpolygon($im,array($points[2],$points[3],$points[4],$points[5],8000,8000+$points[5]-$points[4],8000,0),4,$spia);
ImageString($im, 31, 5, 5, $fac.” “.$pointsb,$spia);
ImagePNG($im);
function rsum($v, $w)
{
$v = $v.”,”.$w;
return $v;
}
?>
Which is shown by:
spistart.php:
[code=php]<html>
<head>
<title>Fractal</title>
<script type=”text/javascript”>
function dozoom(a){
var a=document.getElementById(“fra”);
a.style.width=parseInt(a.style.width)*1.1;
a.style.height=parseInt(a.style.height)*1.1;
a.style.top=parseInt(a.style.top)-parseInt(a.style.height)*0.035;
a.style.left=parseInt(a.style.left)-parseInt(a.style.width)*0.04;
}
function loader(){
var a=document.getElementById(“fra”);
a.style.top=document.body.clientHeight/2-150;
a.style.left=document.body.clientWidth/2-150;
}
</script>
</head>
<body onload=”loader()”>
<img src=”spiraldone.php” style=”width:300px; height:300px; position:absolute; left:0px; top:0px;” onclick=”dozoom()” id=”fra” />
<imput type=”button” value=”Down!” onclick=”document.getElementById(‘fra’).style.top=parseInt(document.getElementById(‘fra’).style.top)+25;”></body>
</html>
How do I pass the value of the variable $fac from spiraldone.php to a javascript variable in spistart.php?
Thanks in advance,
Neil