PDA

View Full Version : Timed function


ashleypower
04-15-2003, 02:09 PM
Is there a way to execute a function after a certain amount of time?

Thanks.

Weirdan
04-15-2003, 02:18 PM
RTFM (Read This Fine Manual :) ) (http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/methods/settimeout.asp)

ashleypower
04-15-2003, 02:51 PM
I need to execute multiple functions across a frame in a certain amount of time, that's the only way that I can figure out how to do this!

Help?

Spudhead
04-15-2003, 03:02 PM
I think we might need some more info. setTimeout() and setInterval() are, AFAIK, the only ways of controlling script execution according to a timeframe. If you need to do this within a certain timescale, it's going to get tricky. What, exactly, are you tying to accomplish?

ashleypower
04-15-2003, 03:32 PM
It's a little complex....

In the left frame is a test. In the right frame, the values from the answers in the left frame are stored here.

When the test is complete, the values are calculated in the right frame, and then sent to the left frame using a button. Then a 3 letter code is found using a button in the left frame.

Here's my problem.

I don't want the user to see the right frame at all, but there is a button there that needs to be pressed in order for it to work.

I'll upload it and show you.

http://www11.brinkster.com/powera/aaa/frame.htm

Take a look.

Please help! I'm a web DESIGNER, and my boss got me into this complicated stuff.

Thanks alot.

beetle
04-15-2003, 03:40 PM
If you don't intend for the right-frame to ever be seen, why use it at all? What I'm getting at is this: why are you storing all that data in form elements? Why not just use regular variables?

ashleypower
04-15-2003, 03:44 PM
This test is actually 9 pages long. I just uploaded 1 to show you what I meant.

ashleypower
04-15-2003, 03:45 PM
P.S. I SUCK at JavaScript! Haha!

beetle
04-15-2003, 03:49 PM
Ohh. So you're storing each page result into that frame, then totalling at the end.

Why not have functions in the left frame read the data from the right frame, instead of having functions in the right frame passing to the left frame?

ashleypower
04-15-2003, 04:06 PM
This is what I tried, but it doesn't work!

function getv() {

document.myForm.textboxA.value = top.frames['values'].document.end.totala.value;


}

What am I doing wrong?

beetle
04-15-2003, 04:21 PM
Did you get any sort of error from that?

ashleypower
04-15-2003, 04:22 PM
Nope!

beetle
04-15-2003, 04:30 PM
Okay, withour re-writing all your JS (which it needs :( ) here's a solution, I hope. First, in your right frame, insert this functionfunction doAll()
{
adda();
addb();
addc();
addd();
adde();
addf();
parent.passar(document.end.totala.value);
parent.passbr(document.end.totalb.value);
parent.passcr(document.end.totalc.value);
parent.passdr(document.end.totald.value);
parent.passer(document.end.totale.value);
parent.passfr(document.end.totalf.value);
}That performs all the operations your button does. Now, from the left frame, call this function like thistop.frames['values'].doAll();If you'd like all this javascript re-written, let's make arrangements to have your boss contact me, or vice versa.

Vladdy
04-15-2003, 05:11 PM
Why use damn frames at all :rolleyes:
If you need to present certain number of questions at a time, just spread them among divs and do style.display='none'/'block'

beetle
04-15-2003, 05:13 PM
Originally posted by Vladdy
Why use damn frames at all :rolleyes:
If you need to present certain number of questions at a time, just spread them among divs and do style.display='none'/'block' My thoughts exactly :cool:

ashleypower
04-15-2003, 05:50 PM
Why? Because I don't know how! Haha!