born Posted January 11, 2007 Report Share Posted January 11, 2007 Ir dokuments, no kura var atvēta uzlecošo logu. Uzlecošajā logā izdara šādas tādas lietas un kad to aizver, pamata logā parādās izmaiņas, neizmantojot refrešu! Talkā ņemam to pašu nodrāzto http://homepage.mac.com/kevinmarks/staticjah.html (Static JAH). Nav nekādas problēmas popapa logā uzģenerēt kautko tādu: jah('fails.php?izmaiņas=blblblblblbl,'target'); ielikt to onUnload eventā, lai tas palaižās aizvetoties pop up logam...bet protams šī rinda nemainīs saturu pamata lapā, bet gan pop up logā, jah('fails.php?izmaiņas=blblblblblbl,'target'); . Kā pārformēt to lietu, lai sas tiktu padots uz pamata lapu. ir idejas. šāds izskatās tas Static JAH failiņš. function jah(url,target) { // native XMLHttpRequest object document.getElementById(target).innerHTML = 'sending...'; if (window.XMLHttpRequest) { req = new XMLHttpRequest(); req.onreadystatechange = function() {jahDone(target);}; req.open("GET", url, true); req.send(null); // IE/Windows ActiveX version } else if (window.ActiveXObject) { req = new ActiveXObject("Microsoft.XMLHTTP"); if (req) { req.onreadystatechange = function() {jahDone(target);}; req.open("GET", url, true); req.send(); } } } function jahDone(target) { // only if req is "loaded" if (req.readyState == 4) { // only if "OK" if (req.status == 200) { results = req.responseText; document.getElementById(target).innerHTML = results; } else { document.getElementById(target).innerHTML="jah error:\n" + req.statusText; } } } visticamāk, ka jāmaina šīs document.getElementById(target).innerHTML vietas. rakos netā, bet skaidrību tādu neieguvu. ir kādas idejas? Link to comment Share on other sites More sharing options...
hmnc Posted January 11, 2007 Report Share Posted January 11, 2007 apskati opener. objektu Link to comment Share on other sites More sharing options...
born Posted January 12, 2007 Author Report Share Posted January 12, 2007 (edited) ok, js failu pamainīju, īstenība īzī, sametu priekšā opener. (bija tāda aizdoma ka k-kas līdzīgs jādara, bet tajā pasša lapā rakājoties nekādi neuzskrēju virsū tam). nomainīju uz šādu. function jah(url,target) { // native XMLHttpRequest object opener.document.getElementById(target).innerHTML = 'sending...'; if (window.XMLHttpRequest) { req = new XMLHttpRequest(); req.onreadystatechange = function() {jahDone(target);}; req.open("GET", url, true); req.send(null); // IE/Windows ActiveX version } else if (window.ActiveXObject) { req = new ActiveXObject("Microsoft.XMLHTTP"); if (req) { req.onreadystatechange = function() {jahDone(target);}; req.open("GET", url, true); req.send(); } } } function jahDone(target) { // only if req is "loaded" if (req.readyState == 4) { // only if "OK" if (req.status == 200) { results = req.responseText; opener.document.getElementById(target).innerHTML = results; } else { opener.document.getElementById(target).innerHTML="jah error:\n" + req.statusText; } } } ja iemetu popup logā saiti: <a href="java script:jah('content_switch.php','images');">update</a> tad no nospiežot vis vajadzīgais apdeitojās un viss bumbās. BET. ja izdaros šitādi: <body onUnload="java script:jah('content_switch.php','images');" > tad īpaši nekas negrib strādāt. t.i. aizverot logu viss uzkarās uz "sending...". Edited January 12, 2007 by born Link to comment Share on other sites More sharing options...
born Posted January 13, 2007 Author Report Share Posted January 13, 2007 (edited) Būtu labi, ja kāds kurš nojauš problēmas atrisinājumu dotu vismaz kādu pavedienu... Paldies, sam pridumal, ieliku attiecīgajā vietā iekš onload, nevis onunload...iznāk par foršāk nekā gribēju :) Edited January 13, 2007 by born Link to comment Share on other sites More sharing options...
hmnc Posted January 16, 2007 Report Share Posted January 16, 2007 onload events nostrādā kad lapa ir pilnībā ielādēta, bet onunload, ja nemaldos kad tu maini location.. resp taisi browseru ciet vai spied kādu linku. un novāc to "java script:" priekšā. tas nav vajadzīgs. Link to comment Share on other sites More sharing options...
Grey_Wolf Posted January 16, 2007 Report Share Posted January 16, 2007 onunload, ja nemaldos kad tu maini location.. resp taisi browseru ciet vai spied kādu linku. Skjiet ka uz jaunajiem brauzeriem tas pat ir speciali jaiesleedz, preciizaak Jaizsleedz Popup Blokeris.. :) Link to comment Share on other sites More sharing options...
Recommended Posts