/    Sign up×
Community /Pin to ProfileBookmark

execute script THEN redirect

Okay, here’s my problem, I want to have a page load on opening, execute the “typewriter script” and, only when the script has ended, load another page…

What I’ve done doesn’t work… The type writer script works perfectly alone, but it doesn’t get to start before the page is redirected (whatever I put as “waiting time”)…

I would like to find a way to make the page execute the script and redirect only when it is done…

Here it is anyway:

[code=php]<html>
<head>
<title>MAIN FRAME LOADING</title>
<META HTTP-EQUIV=”Refresh”
CONTENT=”3;URL=http://www…/filelist.html”>
<base target=”contents”>
<SCRIPT LANGUAGE=”JavaScript”>
<!–
function redirect () {
setTimeout(“go_now()”,3000);
}
function go_now () {
window.location.href = “http://www…/filelist.html”;
}
//–>
</SCRIPT>
</head>
<body topmargin=”0″ leftmargin=”0″
bgcolor=”#000000″>
<DIV ID=ejs_box2_box STYLE=”background:#000000;color:#ffffff;
font-familly:fixed width;font-size:14;
width:500;height:145;padding:5″></DIV>
<SCRIPT LANGUAGE=JavaScript>
<!–
/*
letter by letter box
*/
ejs_box2_message = new Array;
ejs_box2_message[0] = ‘<FONT FACE=”Courier New” size=”2″>
WELCOME TO FILE VIEWER 3.2<br>
LOADING FILE LIST…<br>
RENDERING FILE LIST</FONT>’;

ejs_box2_actual = 0;
ejs_box2_html_flag = 0;

function ejs_box2_go()
{
if(document.getElementById)
{
ejs_box2_char = 1;
ejs_box2_affich(ejs_box2_actual)
ejs_box2_actual++;
if(ejs_box2_actual >= ejs_box2_message.length)
ejs_box2_actual = 0;
}
}

function ejs_box2_affich(lactual)
{
var pix = ejs_box2_message[lactual].charAt(ejs_box2_char);
if(pix == “<“)
ejs_box2_html_flag = 1;
if(pix == “>”)
ejs_box2_html_flag = 0;
var texte = ejs_box2_message[lactual].substring(0,ejs_box2_char);
document.getElementById(“ejs_box2_box”).innerHTML = texte;
if(ejs_box2_char < ejs_box2_message[lactual].length)
{
ejs_box2_char++;
if(ejs_box2_html_flag == 1)
ejs_box2_affich(lactual);
else
setTimeout(“ejs_box2_affich(“+lactual+”)”,100)
}}

window.onload = ejs_box2_go;
//–>
</SCRIPT>
</body>
</html>[/code]

Can you help me??

to post a comment
JavaScript

9 Comments(s)

Copy linkTweet thisAlerts:
@luke0Aug 27.2003 — you have to put the file list were it says www......./filelist.html

and your site:eek:

e.g www.mysite.com/hello.html

which WILL load the file


from luke0 (age 14)

:o
Copy linkTweet thisAlerts:
@David_HarrisonAug 27.2003 — Use this script of mine, it has all of the custommizable bits at the top of the script, and includes a redirect once the script has finished.

I noticed another problem in your script by the way, the redirect function was never called.

[upl-file uuid=cd8e8de2-917a-4d65-9fcc-744b81a3b8cd size=2kB]typewriter4.txt[/upl-file]
Copy linkTweet thisAlerts:
@nashauthorAug 27.2003 — Thanx for your script but it will not work in my case (execute the "typewriting script" alone to see what I want... Yours apparently cannot do that...

I know the redirect function is not called, it autoexecutes itself when the page loads!

My problem is to find a way of moving the redirect function so that it doesn't executes itself until the "typewriter script" is done...
Copy linkTweet thisAlerts:
@David_HarrisonAug 27.2003 — I removed the line:

window.location.href = "http://www.../filelist.html";

And absolutely nothing happened, so I'm not sure what it is supposed to look like.
Copy linkTweet thisAlerts:
@nashauthorAug 28.2003 — ? I've chopped off the whole first script (the redirecting one) and uploaded the resulting page [url=http://www.geocities.com/nash_sw2001/violet/typewriterbox.html]here[/url]...

I think it didn't worked when you tried because I edited the code in my first post so that it doesn't resize the boards too much? I went to the line after the <br> in my message, which should not be done in the actual script or it gives a "string continuation error"!

Now, the typewriter script works just fine, it's the redirecting one that I can't get to work properly! It redirects before the typewriter starts whatever I put as "waiting time"! It looks like the browser waits to redirect [b]and[/b] to start the typewriter script:rolleyes:
Copy linkTweet thisAlerts:
@nashauthorAug 28.2003 — ? pleeease! ? Help!
Copy linkTweet thisAlerts:
@luke0Aug 28.2003 — wot r u on about dude

[URL=http://wakeup.to/russells]my site[/URL]
Copy linkTweet thisAlerts:
@David_HarrisonAug 28.2003 — OK, I've got a few things to say:

  • * Never use this <FONT FACE="Courier New" size="2">, it's depreciated and should not be used anymore.


  • * I could modify my script to look exactly like that in no time. Alternatively you could modify your script to detect when the script has finished writing and then redirect, I would do this for you but I didn't write it and so I can't follow how the script has been written.


  • * Also your CSS is wrong, here's yours:


  • <DIV ID=ejs_box2_box STYLE="background:#000000;color:#ffffff;

    font-familly:fixed width;font-size:14;

    width:500;height:145;padding:5"></DIV>

    here's what it should be:

    <div id="ejs_box2_box" style="background-color:#000;color:#fff;

    font-familly:fixed width;font-size:14px;

    width:500px;height:145px;padding:5px;"></div>

    I'll be back in a min with a replacement script, (if you're interested).
    Copy linkTweet thisAlerts:
    @David_HarrisonAug 28.2003 — A bit longer than expected but I went away and did something else as well.

    [upl-file uuid=56e16c01-0129-44f0-b01f-dd3ed6e40e34 size=2kB]typewriter5.txt[/upl-file]
    ×

    Success!

    Help @nash spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.19,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...