Re: VBScript in HTML Page / On_Load
- From: <mpiceni@xxxxxxxxxxxxxxxx>
- Date: Mon, 2 Jul 2007 09:22:45 +0200
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
------------------------------------------------------------------------
.
- References:
- VBScript in HTML Page / On_Load
- From: KAHruzer
- VBScript in HTML Page / On_Load
- Prev by Date: Re: Checking contents of FTP directory
- Next by Date: Re: Where?
- Previous by thread: VBScript in HTML Page / On_Load
- Next by thread: Re: Copy only archivable items
- Index(es):
Relevant Pages
|