Fw: [PHP] javascript
| From: | Kevin Stone | Date: | Wed, 29 May 2002 19:00:50 +0000 |
| Subject: | Fw: [PHP] javascript | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-99787@lists.php.net to get a copy of this message | ||
Instead of all those echo statments use the concatonation operator (.) to
combine variables and quoted strings. It'll make your code much easier to
read. After I cleaned up your code it worked perfectly. Looks like you may
be missing a semi-colin there on line #1 of your javascript code. Other
than that I can find nothing wrong.
$height = 400;
$width = 400;
echo '<script language="JavaScript">';
echo 'WinName="test";'; //<-- there was a missing semi colin here giving me
a javascript error.
echo 'GoURL="test.html";';
echo "var hdth=$height;";
echo "var wdth=$width;";
echo 'pParams="width="+wdth+",height="+
hdth+",top="+((screen.availHeight/2)-(hdth/2))+",left="+((screen.availWidth/
2)-(wdth/2));';
echo 'newWindow = window.open(GoURL,WinName,pParams);';
echo '</script>';
-Kevin
----- Original Message -----
From: "burak delice" <bdelice@abt.com.tr>
To: <php-general@lists.php.net>
Sent: Wednesday, May 29, 2002 10:33 AM
Subject: [PHP] javascript
> why is that code t working?
>
> <?
> //I am calling this php file as
> //http://localhost/Aksu/web/getimage.php?resim=K00.jpg
> $size = GetImageSize ("images/$resim");
> echo "<script language=\"JavaScript\">";
> echo "WinName=\"";echo $resim; echo "\"
> ";
>
> echo "GoURL=";echo"\"images/resimgoster.php?res="; echo $resim; echo
"\";
> ";
> echo "var hdth="; echo $size[0]; echo ";
> ";
> echo "var wdth="; echo $size[1]; echo ";
> ";
>
> echo "pParams=\"width=\"+wdth+\",height=\"+ hdth
>
+\",top=\"+((screen.availHeight/2)-(hdth/2))+\",left=\"+((screen.availWidth/
> 2)-(wdth/2));
> ";
> echo "newWindow = window.open(GoURL,WinName,pParams);";
> echo "</script>";
> ?>
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>