From: DL on 3 Jun 2010 08:19 On Jun 3, 7:55 am, SAM <stephanemoriaux.NoAd...(a)wanadoo.fr.invalid> wrote: > Le 6/3/10 5:57 AM, DL a écrit : > > > > >pageA > > ====== > > <html> > > <head> > > </head> > > <script type="text/javascript"> > > rl() { > > if (self.reload()) { > > where did you find that ? > > maybe > if(self.location.reload) > but ... not better > > function rl() { > document.getElementById('tell').innerHTML = new Date(); > > } > > I don't think you can test if thepageis reloaded. > > function setTime() { > window.time = new Date();} > > function rl() { > var d = new Date(); > if(!!window.time && d-window.time>0) > document.getElementById('tell').innerHTML = 'pagereloaded'; > > } > > <body onunload="setTime();" onload="rl();"> > > No that can't work, the window forgets everything when a new (or same)pageis loaded in it. > > -- > sm Yeah, I was totally mindless of forgetting the "function" key word... just rewriting the page A code below... but according to you, it looks like we're stuck, right? There must be a solution to it! Thanks, Sam. Don Page A ====== <html> <head> </head> <script type="text/javascript"> function whynot() { document.getElementById('local').innerHTML = "local click test result: Main page reloaded."; } function rl() { if (reload()) { document.getElementById('tell').innerHTML = "Main page reloaded."; } } </script> <body onload="rl();"> <h1>page A</h1> <div id="local"></div> <div id="tell"></div> <form> <input type="button" onclick="whynot()" value="local click test"> </form> <a href="pageB.html" target="_new">go to page B</a> </body> </html> page B ====== <html> <head> <script type="text/javascript"> var F1 = false; function pop(what) { if(!F1 || F1.closed) F1 = window.open('','F1','width=300,height=300'); F1.location = what; // F1.location = what.href; F1.focus(); if(F1 || opener) { opener.location.reload(); // reload the pA opener.getElementById('tell').innerHTML = "Main page reloaded from pB."; // indicate so /* refresh A */ return false; } /* function init() { var a = document.links, n = a.length; while(n--) a[n].onclick = function() { return pop(this); } } */ </script> </head> <body onload="pop();" onunload="if(F1 && !F1.closed) F1.close();"> <h1>page B</h1> <form> <input type="button" onclick="window.open('pageC.html? id=762','','width=300,height=300')" value="pC"> <!-- please note the above id value is dynamically generated by a server side web scripting language --> </form> </body> </html>
From: DL on 3 Jun 2010 22:31 On Jun 3, 8:19 am, DL <tatata9...(a)gmail.com> wrote: > On Jun 3, 7:55 am, SAM <stephanemoriaux.NoAd...(a)wanadoo.fr.invalid> > wrote: > > > > > Le 6/3/10 5:57 AM, DL a écrit : > > > >pageA > > > ====== > > > <html> > > > <head> > > > </head> > > > <script type="text/javascript"> > > > rl() { > > > if (self.reload()) { > > > where did you find that ? > > > maybe > > if(self.location.reload) > > but ... not better > > > function rl() { > > document.getElementById('tell').innerHTML = new Date(); > > > } > > > I don't think you can test if thepageis reloaded. > > > function setTime() { > > window.time = new Date();} > > > function rl() { > > var d = new Date(); > > if(!!window.time && d-window.time>0) > > document.getElementById('tell').innerHTML = 'pagereloaded'; > > > } > > > <body onunload="setTime();" onload="rl();"> > > > No that can't work, the window forgets everything when a new (or same)pageis loaded in it. > > > -- > > sm > > Yeah, I was totally mindless of forgetting the "function" key word... > just rewriting the page A code below... > but according to you, it looks like we're stuck, right? There must be > a solution to it! > > Thanks, Sam. Don > > Page A > ====== > <html> > <head> > </head> > <script type="text/javascript"> > function whynot() { > document.getElementById('local').innerHTML = "local click test result: > Main page reloaded."; > } > > function rl() { > if (reload()) { > document.getElementById('tell').innerHTML = "Main page reloaded."; > } > > } > </script> > > <body onload="rl();"> > > <h1>page A</h1> > > <div id="local"></div> > <div id="tell"></div> > > <form> > <input type="button" onclick="whynot()" value="local click test"> > </form> > > <a href="pageB.html" target="_new">go to page B</a> > </body> > </html> > > page B > ====== > > <html> > <head> > <script type="text/javascript"> > var F1 = false; > > function pop(what) { > if(!F1 || F1.closed) > F1 = window.open('','F1','width=300,height=300'); > F1.location = what; > // F1.location = what.href; > F1.focus(); > if(F1 || opener) { > opener.location.reload(); // reload the pA > opener.getElementById('tell').innerHTML = "Main page reloaded from > pB."; // indicate so > /* refresh A */ > return false; > > } > > /* > function init() { > var a = document.links, n = a.length; > while(n--) a[n].onclick = function() { return pop(this); } > > } > > */ > > </script> > </head> > > <body onload="pop();" onunload="if(F1 && !F1.closed) F1.close();"> > <h1>page B</h1> > > <form> > <input type="button" onclick="window.open('pageC.html? > id=762','','width=300,height=300')" > > value="pC"> > <!-- please note the above id value is dynamically generated by a > server side web scripting > > language --> > </form> > > </body> > </html> Sam, here's an update. I've solved the problem, probably I can say perfectly for Firefox but manage to have a workaround with IE. Don
First
|
Prev
|
Pages: 1 2 3 Prev: FAQ Topic - What is a native object? (2010-06-01) Next: Qooxdoo--garbage? |