Re: VBScript in HTML Page / On_Load

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi,

this is what your application is expected to do. The href property, doesn't
open a page, but it simply sets the link of the page loaded in the browser.
The page (and all the window) is initialized just after the Window_OnLoad
function terminates. Your code sets the href property, then overwrite it
with a different value, so that previous values are discarded, and only the
last one is considered as soon as the Window_OnLoad function terminates.
If you want to do multiple downloads, you need to use the XMLHTTP object to
download one file at a time (iterate through the various link). Moreover,
you don't have to do this inside the Window_OnLoad function, because the
page is still uninitialized. If you need to start something at window
opening, the best way is the following (assuming that MyInit is the name of
the function to start at window opening):

Sub window_OnLoad
window.setTimeout "MyInit", 10, "VBScript"
End Sub

In this way, the loading of the window terminates and you procedure start
just after (10 ms later). So you've access to the
window.document.body.innerhtml that represents the HTML of your page and can
be changed at runtime. You can collect different informations from different
links, assemble on a string and then transfer to the page. One
reccomendation: never use:
window.document.body.innerhtml = window.document.body.innerhtml & .....
instead use:
sTemp = sTemp & ...
.....
window.document.body.innerhtml = sTemp
The first way is much slower and, sometimes, doesn't do what expected.

Hope this helps.

Massimo.

"KAHruzer" <KAHruzer.2t0m64@xxxxxxxxxxxxxxxxxxxxx> ha scritto nel messaggio
news:KAHruzer.2t0m64@xxxxxxxxxxxxxxxxxxxxxxxx

I've been trying to use the Sub Window_OnLoad( ) VBScript
in an HTML webpage.

I'm using it to automate data file downloading of multiple data files.
These are daily weather statistic files.

So far, it works fine for a single file download, but haven't been able
to get it to do multiple file downloads. In the code below, only the
LAST file requested is actually downloaded, no matter how many different
file requests are made in the listing (this one has only two, so the
second one is the only one which actually downloads).

I'm sure I'm just missing a trick or something.
Anyone know what it is? My VBScripting isn't at all good yet.

==============================

Here's the Code below:

<html>

<head><script LANGUAGE="VBScript">
<!--
Sub window_onLoad()
Window.location.href =
"http://www.mesonet.org/premium/data/getfile.php?dir=/mts/2005/12/31/20051231bixb.mts&filename=20051231bixb.mts";
Window.location.href =
"http://www.mesonet.org/premium/data/getfile.php?dir=/mts/2007/01/01/20070101skia.mts&filename=20070101skia.mts";

end sub
-->
</script>

<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
<title>TEMP Mesonet Site LIST - Produced by AutoLISP Function C:GET(
)</title>

</head>

<body>

</body>

</html>



--
KAHruzer
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------



.



Relevant Pages

  • Re: Corrupted and Unreadable Files
    ... for anything but downloads. ... command window prompt. ... > legitimate SFN. ... I have tried the 'standard' actions. ...
    (microsoft.public.windows.file_system)
  • security patch
    ... It's annoying that we have to resort to finding help this ... way cos if these downloads come from Microsoft you'd think ... >download the remedy without that shut down window coming ... >If at anytime the window opens stating the "NT ...
    (microsoft.public.windowsxp.security_admin)
  • Re: perl rpm links needed - Suse 10
    ... all of those links go to tarball downloads. ... >>> rpms since I do not know how to install tarballs. ... At the top of konqueror click on the tab marked 'Window' ... Now repeat these steps for the other packages you downloaded!! ...
    (alt.os.linux.suse)
  • Re: Observations from a Windows user
    ... Firefox is in when under XP, I have closed the app / window / ... Firefox is very much open when the downloads are going. ... On Windows, an application isn't closed until the last window it owns is closed. ... At that point, the app should exit. ...
    (uk.comp.sys.mac)
  • Re: Very strange add-in file behaviour
    ... > place would give more weight, IMO, to problems with the upload-download ... > downloads. ... >> Sub MakeVBScriptAutoRunFile(strFile As String) ...
    (microsoft.public.excel.programming)