vabole Posted December 23, 2006 Report Share Posted December 23, 2006 Var kāds uzrakstīt snipetu, kā es varu no JS pārnest, piem, screen.width uz PHP. Es domāju no lapas uz lapu (citu iespēju laikam nav). Pieņemu, ka man jāizmanto $_GET, bet, kas notiek ar JS, nezinu ... Link to comment Share on other sites More sharing options...
Stopp Posted December 23, 2006 Report Share Posted December 23, 2006 (edited) var kaka='tralivali'; window.location='lapa.php?mainigais='+kaka; edit: Lai nepārlādējas lapa, izmanto vai nu ifreimu, vai ajaxu. Edited December 23, 2006 by Stopp Link to comment Share on other sites More sharing options...
vabole Posted December 23, 2006 Author Report Share Posted December 23, 2006 Kā man īsti izmantot iframe, un ajax, kā izmantot? Link to comment Share on other sites More sharing options...
bubu Posted December 23, 2006 Report Share Posted December 23, 2006 Ja tev datus nevajag dabūt atpakaļ no tā skripta, tad izmanto kaut parastu bildi: <img src="" id="magic_bilde" style="display:none"/> un Javaskriptā: var img = document.getElementById("magic_bilde"); img.src = "skripts.php?data1=blah&cits_mainiigais=2"; Ja vajag php skriptam kautko atgriezt atpakaļ, tad, kā jau tev teica: AJAX vai iframe. Pameklē forumā, daudzas reizes jau runāts. Kautvai tajā satura rādītājā apskaties, tur par Ajax (XMLHttpRequest) ir daži labi topiki. Link to comment Share on other sites More sharing options...
Stopp Posted December 23, 2006 Report Share Posted December 23, 2006 bubu, nebija tā, ka img tags ar display: none netika ielādēts? Kaut kur tepat to nesen kā viens teica. Link to comment Share on other sites More sharing options...
bubu Posted December 23, 2006 Report Share Posted December 23, 2006 Ah pareiz, piemirsās. Link to comment Share on other sites More sharing options...
andrisp Posted December 23, 2006 Report Share Posted December 23, 2006 Tādā gadijumā var izmantot visibility: hidden; Link to comment Share on other sites More sharing options...
Stopp Posted December 23, 2006 Report Share Posted December 23, 2006 Tas nedaudz čakarē lapas izskatu. Manuprāt, vislabāk ir img tags iekš diva/spana ar display: none Link to comment Share on other sites More sharing options...
bubu Posted December 23, 2006 Report Share Posted December 23, 2006 Domā browseris ir tik stulbs, ka tad lādēs bildi? Link to comment Share on other sites More sharing options...
vabole Posted December 23, 2006 Author Report Share Posted December 23, 2006 (edited) index.php <iframe style="display: none" src="lapa.php"></iframe> lapa.php var x=screen.width; var y=screen.height; window.location='index.php?platums='+x+'&augstums='+y; <? $platums=$_GET['platums']; $augstums=$_GET['augstums']; ?> Šitā? Šitā nedarbojas ... IE pārlādē. Edited December 23, 2006 by vabole Link to comment Share on other sites More sharing options...
bubu Posted December 23, 2006 Report Share Posted December 23, 2006 Tak ne jau ifreimā iekšā liec to JS, bet gan index.php lapā. Un tad dinamiski uzstādi iframe src atribūtu - tādā pašā veidā kā es augstāk bildei to darīju. Link to comment Share on other sites More sharing options...
vabole Posted December 23, 2006 Author Report Share Posted December 23, 2006 (edited) Nevaru iebraukt, labi, sākums ir index.php <script type = "text/javascript"> var x=screen.width; var y=screen.height; window.location='index.php?platums='+x+'&augstums='+y; </script> Kas tālāk? Edited December 23, 2006 by vabole Link to comment Share on other sites More sharing options...
bubu Posted December 24, 2006 Report Share Posted December 24, 2006 Izvāc window.location un apskaties vēlreiz manu postu augstāk. Link to comment Share on other sites More sharing options...
Stopp Posted December 24, 2006 Report Share Posted December 24, 2006 Domā browseris ir tik stulbs, ka tad lādēs bildi? Zinu, ka lādēs. Līdz šim nav bijis problēmu ar nevienu pārlūku. Vēl jau, protams, vai likt tai bildei width un height uz 0. vabole, te ir forši parādīta visa freimu sistēma javaskriptā, kā ar tiem strādāt - http://www.quirksmode.org/js/frameintro.html Link to comment Share on other sites More sharing options...
vabole Posted December 24, 2006 Author Report Share Posted December 24, 2006 (edited) Šādi? index.php <img src="" id="magic_bilde" style="display:none"/> <script type = "text/javascript"> var x=screen.width; var y=screen.height; window.location='rezolucija.php?platums='+x+'&augstums='+y; var img = document.getElementById("magic_bilde"); img.src = "rezolucija.php?platums='+x+'&augstums='+y; </script> Edited December 24, 2006 by vabole Link to comment Share on other sites More sharing options...
Recommended Posts