Reply to Re: Use php variable in javascript function

Your name:

Reply:


Posted by countach on 10/19/06 10:29

You have to keep in your mind that, in fact, PHP only mission is to 'paint'
the data that travel to the user browser.

Knowin' that, you can 'send' html, javascritp, css... plain text, or what
ever you want. Then the browser will treat is exactly as if it were reading
a normal .html file for example.


En las nuevas, el emilia.woo@gmail.com escribiσ:
> Oh, I find out!.
> it's just
>
> <input type="button" onclick="practice( '<? echo $ex; ?>' ); ">
>
> right?
>
> emilia.woo@gmail.com wrote:
>> Hello guys.
>> I have a question about js function and php variables.
>>
>> I want to use php variables in javascript function. For example,
>>
>>
>> <?php
>> $ex=(int)$_POST['Example'];
>>>
>>
>> $ex value is 3
>>
>> There's js function named "practice"
>> I want to run
>>
>> <input type="button" onclick="practice(3); ">
>>
>> in this case, 3 is $ex. However, I cannot use like this:
>>
>> <input type="button" onclick="practice( <? $ex ?> ); ">
>>
>> How can I use php variables in javascript function? Thank you.

[Back to original message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация