Re: Javascript and PHP interaction

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Alain Roger wrote:
Hi,

I would like to know if there is a way how PHP code can extract from
ElementID some property values.

for example, i have the following PHP page :

<?php
print "<div class='maindiv' id='id_maindiv'>my main div</div>";
$new_Width = somefunction();
print "<div class='childdiv' id='id_childdiv'
style='width:".$new_Width."px;'>my child div</div>";
?>
in my CSS file (which is link to my HTML page), i have :

.maindiv
{
width : 300px;
height : 400px;
background-color : #EEBBEE;
}
.childdiv
{
background-color : #BBBBBB;
}

my PHP code should be able :
- to extract the width of id_maindiv ID (so to get 300px) and to reduce it
by 50px

the problem is that i tried with Javascript and if the property
(style:width) is not define DIRECTLY to HTML code (but only in CSS file),
the javascript is not able to return the value (but only 'undefined').
So i would like to know if PHP could help me in this way ?

thanks a lot,


PHP is a server side language, meaning that once it has sent your page to the client (browser) then it's work is done. You could probably use PHP to parse the value out of the CSS file and use it that way... look in the manual for filesystem functions to open the CSS file, and check out preg_match to find your value.

HTH,

Mikey

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux