Re: Javascript and PHP interaction

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

 



2007. 03. 8, csütörtök keltezéssel 09.14-kor Alain Roger ezt írta:
> 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 ?

I think you can not do it with PHP.
But you can do it with javascript. you have to read the offsetWidth
property of the object, then set it's style.width like

if (document.getElementById('whatever').offsetWidth > 300) {
	document.getElementById('whatever').style.width = 300;
}

hope that helps
Zoltán Németh

> 
> thanks a lot,
> 

-- 
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