virtualcook Posted November 20, 2003 Report Share Posted November 20, 2003 Vai kāds nevarētu pateikt kā var izsaukt JavaScript funkciju php scriptā? Link to comment Share on other sites More sharing options...
Roze Posted November 21, 2003 Report Share Posted November 21, 2003 To burtiski nav iespeejams.. Jo PHP ir serverside a JS klientside lieta. Iespeeja kaa darbinaat JS funkciju ir ar php izvadiit kodu kas sho funkciju palaistu piem ja kaut kur kodaa ir <script> function somefunc() { ... blabla ... } </script> Tad ar php var izsaukt $echo = '<script>somefunc();</script>'; Vai likt arii pie kaada eventa alja onBodyLoad onClick onMouseOver utt utt Link to comment Share on other sites More sharing options...
Venom Posted November 21, 2003 Report Share Posted November 21, 2003 burtiski ir iespējams, uz win32 no php piekonektējoties pie IWebBrowser COM interfeisa un tad ar DOM parullēt (esmu ņirgājies ar Wordu un PDF Readeri). Bet vieglāk tomēr ir vienkārši iz_echo_t. Vai uzlikt ar pašu javascriptu setTimeout. ja vajag, lai kaut kāda funkcija nostrādā tieši pie lapas pilnīgas izvadīšanas, tad pašās beigās izecho/ieinklūdo rozes ieteikto sktripta variantu. Link to comment Share on other sites More sharing options...
virtualcook Posted November 21, 2003 Author Report Share Posted November 21, 2003 ... jaa funkcija izpildas, bet atgriezto veertiibu (return) ieguut nesanaak: $returnValue = $echo = '<script>somefunc();</script>'; --------- nez, varbuut daru nepareizi, bet shaadaa veidaa es veeleejos atgriezt document.body.clientWidth; Varbuut kaa citaadi var ieguut loga izmeerus? Link to comment Share on other sites More sharing options...
Venom Posted November 21, 2003 Report Share Posted November 21, 2003 (edited) Pareizi jāzudod jautājums: kā no JS dabūt uz php kādu vērtību? Ar javascriptu pieliec document.body.clientWidth vērtību kā get variābli, respektīvi <?php if (!isset($_GET['screen'])) { ?> <script> location.href=location.href+'&screen='+document.body.clientWidth; location.reload(); </script> <? } $_GET['screen'] - vēlāmā JavaScript vērtība iekš php Edited November 21, 2003 by Venom Link to comment Share on other sites More sharing options...
virtualcook Posted November 21, 2003 Author Report Share Posted November 21, 2003 tas ir ar ? - pladies straadaa :-)) location.href=location.href+'?screen='+document.body.clientWidth; Link to comment Share on other sites More sharing options...
virtualcook Posted November 21, 2003 Author Report Share Posted November 21, 2003 bet kaapeec citreiz if (!isset($_GET['screen'])) screen veertiiba neinicializeejas un attieciigi visu laiku izsaucas reload - tb muuzhiigais cikls izveidojas? Link to comment Share on other sites More sharing options...
virtualcook Posted November 22, 2003 Author Report Share Posted November 22, 2003 (edited) ar to ieciklēšanos ir tā" ========= šādi ieciklējas ---------------- <?php if (!isset($_GET['screen'])) { ?> <script> location.href=location.href+'&screen='+document.body.clientWidth; location.reload(); </script> <? } =========================== šādi strādā, Done, but with errors on page ------------------------------------------------ <?php if (!isset($_GET['screen'])) { ?> <script> location.href=location.href+'&screen='+document.body.clientWidth; setTimeout(1000); location.reload(); </script> <? } ========================== kāds var norādīt uz kļūdu ? Edited November 22, 2003 by virtualcook Link to comment Share on other sites More sharing options...
Recommended Posts