Javascript

3 отговора 130 прегледа
#1

Javascript

привет.

Как да направя така че когато даден прозорец се рефрешва да не се изпълнява дефинирана на javascript функция onunload

Отговор
в отговор на moarein #2

Re: Javascript

mi she refreshwash po-inache:
<script>
function Refresh()
{
clearTimeout( nTO );
// izberi si edno ot dwete
// window.open( window.location.href, "_self" );
window.location.href = window.location.href;
}

nTO = window.setTimeout( 'Refresh()', 3000 ); // 3000 e milisekundite za prezarejdane estestweno...<script>

idejata smjatam e jasna...

Отговор
в отговор на jaw #3

Re: Javascript

Привет.

Може би не се изразих правилно.

Значи. Имам динамично сменяща се уеб страница. В нея съм написал функция която се извиква на unload. Но когато някой даде рефреш на страница функцията също се изпълнява. Именно това ме притеснява.

Отговор
в отговор на moarein #4

Re: Javascript

To e logichno da se zaregda nali zatowa e onunload...
W momenta w koito refreshne e absolutno logichno za browsera da izstrelq towa sybitie...
Tyrsi drug wariant za onunload.
Wig k'wo pishat horata w MSDN:
Behaviors| Description
onactivate| Fires when the window object is set as the activeElement.
onafterprint| Fires on the window object immediately after its associated document| prints or previews for printing.
onbeforedeactivate | Fires immediately before the activeElement is changed from the current window object to another object in the parent document.
onbeforeprint| Fires on the window object before its associated document prints or previews for printing.
onbeforeunload | Fires prior to a page being unloaded.
onblur | Fires when the window object loses the input focus.
oncontrolselect | Fires when the user is about to make a control selection of an window object.
ondeactivate |Fires when the activeElement is changed from the current window object to another object in the parent document.
onerror| Fires when an error occurs during window object loading.
onfocus | Fires when the window object receives the focus.
onhelp | Fires when the user presses the F1 key while the browser is the active window.
onload | Fires immediately after the browser loads the window object.
onresize| Fires when the size of the window object is about to change.
onresizeend| Fires when the user finishes changing the dimensions of the window object in a control selection.
onresizestart | Fires when the user begins to change the dimensions of the window object in a control selection.
onunload | Fires immediately before the window object is unloaded.

* denotes an extension to the W3C DOM.
Example

JAVA lets make things badly and slow!!
Отговор