- Create Account

onload event capture

Forums > Forum Development > onload event capture
Author
Message

1) djvman Group: Members
Posts: 17 Joined: 22 Dec 2004 Location: iquique-chile IP: 200.72.--.--
angus or anybody else, please i need some help with this.

i have made a script wich resets a cronometer (session time) back to start. I have made it with the idea of reset a page after a while when the user left out his pc.

for understand this i have put and example here:

http://www.iqqimi.cl/crono/index.html

so, if you see on left is the conometer wich is set on 2 minutes, if you clic on anywhere or press any key it will reset to 2 min.

so, now clic on option 2 o 3, it doesn't work. On those pages, i have put specific onload event.

¿why doesn't work? can anybody help me?

this is the external javascript file:

window.onload = initialize;

function initialize () {
    document.onkeydown = reset;
document.onclick = reset;
}

function reset(e) { parent.leftFrame.ResetCrono(); return true; }

please!  any help will be very very much apretiated.

2) djvman Group: Members
Posts: 17 Joined: 22 Dec 2004 Location: iquique-chile IP: 200.72.--.--
did it!

i chage external js file, for this code:

// JavaScript Document
if( document.captureEvents ) {
    //non  IE
    if( Event.CLICK || KEYDOWN) {
        //NS  4, NS 6, Mozilla 0.9.x
        document.captureEvents( Event.CLICK || Event.KEYDOWN);
// document.captureEvents( );
}
}
document.onclick = cronoreset;
document.onkeydown = cronoreset;
function cronoreset(){ parent.leftFrame.ResetCrono(); }

and  it works.

thanks any way

3) Angus Turnbull Group: Moderators
Posts: 4042 Joined: 7 Dec 2003 Location: New Zealand IP: 210.54.--.--
OK, I'm glad you solved your problem. I don't quite see what this has to do with the forum script though...

- Angus.

4) djvman Group: Members
Posts: 17 Joined: 22 Dec 2004 Location: iquique-chile IP: 200.72.--.--
> I don't quite see what this has to do with the forum script though...
i didn't have anyplace to ask, and i didn't know if this is where the right place to post it.
    :=)

Post a Reply:

You are not logged in, and will be posting anonymously as a guest. If you want to post using an account, please login at the top of this page.