Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > How to get the percentage amout of a file being loaded ?

Reply
Thread Tools

How to get the percentage amout of a file being loaded ?

 
 
thisis
Guest
Posts: n/a
 
      11-03-2006
Hi All,

i'm trying to display the amout in percentage for the loading sub event
value,
for the <img .../>


example:

the browser should display something like this:

view 1, time 00:00:05
loading 5%
====================
view 2, time 00:00:010
loading 10%
====================
view 3, time 00:00:57
loading 99%
====================
view 4, time 00:01:00
complete 100%
<!-- the image is showen -->

====================
i have this code:

<script language="vbscript">
Function showState_onready()
IF myImgID.readyState = "loading" then
myDivID.innerText = myImgID.readyState & " " & strPerventage
Else
myDivID.innerText = myImgID.readyState & " " & "100%"
End If
End Function
</script>

<html>
<head></head>
<body>
<div id="myDivID"></div>
<img id="myImgID" src="img.jpg"
onreadystatechange="vbscript:showState_onready('') " />
</body>
</html>

i'm trying to display the image amount of the file loaded in
percentage,
how do i do it?

 
Reply With Quote
 
 
 
 
Anthony Jones
Guest
Posts: n/a
 
      11-03-2006

"thisis" <> wrote in message
news: ups.com...
> Hi All,
>
> i'm trying to display the amout in percentage for the loading sub event
> value,
> for the <img .../>
>
>
> example:
>
> the browser should display something like this:
>
> view 1, time 00:00:05
> loading 5%
> ====================
> view 2, time 00:00:010
> loading 10%
> ====================
> view 3, time 00:00:57
> loading 99%
> ====================
> view 4, time 00:01:00
> complete 100%
> <!-- the image is showen -->
>
> ====================
> i have this code:
>
> <script language="vbscript">
> Function showState_onready()
> IF myImgID.readyState = "loading" then
> myDivID.innerText = myImgID.readyState & " " & strPerventage
> Else
> myDivID.innerText = myImgID.readyState & " " & "100%"
> End If
> End Function
> </script>
>
> <html>
> <head></head>
> <body>
> <div id="myDivID"></div>
> <img id="myImgID" src="img.jpg"
> onreadystatechange="vbscript:showState_onready('') " />
> </body>
> </html>
>
> i'm trying to display the image amount of the file loaded in
> percentage,
> how do i do it?
>


IE doesn't expose info on the current progress of an image download. All
you get is a few changes in state when the download starts to received data
and when the data had complete arrived. You get nothing in between.

The best you can do is guestimate the time involved in the download and use
a window.interval to call an update progress function. In this function
test the readyState of the image if still loading update your progress info
based on time elapsed otherwise set progress to 100% and kill the interval
handle.


 
Reply With Quote
 
 
 
 
thisis
Guest
Posts: n/a
 
      11-03-2006

Anthony Jones wrote:
> "thisis" <> wrote in message
> news: ups.com...
> > Hi All,
> >
> > i'm trying to display the amout in percentage for the loading sub event
> > value,
> > for the <img .../>
> >
> >
> > example:
> >
> > the browser should display something like this:
> >
> > view 1, time 00:00:05
> > loading 5%
> > ====================
> > view 2, time 00:00:010
> > loading 10%
> > ====================
> > view 3, time 00:00:57
> > loading 99%
> > ====================
> > view 4, time 00:01:00
> > complete 100%
> > <!-- the image is showen -->
> >
> > ====================
> > i have this code:
> >
> > <script language="vbscript">
> > Function showState_onready()
> > IF myImgID.readyState = "loading" then
> > myDivID.innerText = myImgID.readyState & " " & strPerventage
> > Else
> > myDivID.innerText = myImgID.readyState & " " & "100%"
> > End If
> > End Function
> > </script>
> >
> > <html>
> > <head></head>
> > <body>
> > <div id="myDivID"></div>
> > <img id="myImgID" src="img.jpg"
> > onreadystatechange="vbscript:showState_onready('') " />
> > </body>
> > </html>
> >
> > i'm trying to display the image amount of the file loaded in
> > percentage,
> > how do i do it?
> >

>
> IE doesn't expose info on the current progress of an image download. All
> you get is a few changes in state when the download starts to received data
> and when the data had complete arrived. You get nothing in between.
>
> The best you can do is guestimate the time involved in the download and use
> a window.interval to call an update progress function. In this function
> test the readyState of the image if still loading update your progress info
> based on time elapsed otherwise set progress to 100% and kill the interval
> handle.


Hi Anthony Jones,

i think your "IE doesn't expose info on the current progress of an
image download."
is in correct.

look at this link, see the status bar on the IE, which displays:
10 items left
9 items left
....
(the displaying happens real fast)
http://images.google.co.il/images?hl...=Search+Images

and i have another example, on my intranet, a page that i worte. i
didn't write anything special for the behaviour of the status bar i
desrcibed.

about your suggestion, i'm trying to think about over.

 
Reply With Quote
 
Anthony Jones
Guest
Posts: n/a
 
      11-03-2006
> > >
> >
> > IE doesn't expose info on the current progress of an image download.

All
> > you get is a few changes in state when the download starts to received

data
> > and when the data had complete arrived. You get nothing in between.
> >
> > The best you can do is guestimate the time involved in the download and

use
> > a window.interval to call an update progress function. In this function
> > test the readyState of the image if still loading update your progress

info
> > based on time elapsed otherwise set progress to 100% and kill the

interval
> > handle.

>
> Hi Anthony Jones,
>
> i think your "IE doesn't expose info on the current progress of an
> image download."
> is in correct.
>
> look at this link, see the status bar on the IE, which displays:
> 10 items left
> 9 items left
> ...
> (the displaying happens real fast)
> http://images.google.co.il/images?hl...=Search+Images


This is updating the as each individual image is complete. You could get
access to this by attaching an event handler to each img in your page. But
your post indicates that you are downloading a single large image.

>
> and i have another example, on my intranet, a page that i worte. i
> didn't write anything special for the behaviour of the status bar i
> desrcibed.


You're refering to the IEs own internal updating to the status bar. IE has
access to the internal workings of the Wininet stack and can therefore can
do things like that as well as show a download progress bar (not that it's
all that reliable anyway). However that does not mean that IE provides any
API by which a page developer can get access to these events. It doesn't.

>
> about your suggestion, i'm trying to think about over.
>


How about letting IE's solution BE the solution?



 
Reply With Quote
 
thisis
Guest
Posts: n/a
 
      11-04-2006

Anthony Jones wrote:
> "thisis" <> wrote in message
> news: ups.com...
> > Hi All,
> >
> > i'm trying to display the amout in percentage for the loading sub event
> > value,
> > for the <img .../>
> >
> >
> > example:
> >
> > the browser should display something like this:
> >
> > view 1, time 00:00:05
> > loading 5%
> > ====================
> > view 2, time 00:00:010
> > loading 10%
> > ====================
> > view 3, time 00:00:57
> > loading 99%
> > ====================
> > view 4, time 00:01:00
> > complete 100%
> > <!-- the image is showen -->
> >
> > ====================
> > i have this code:
> >
> > <script language="vbscript">
> > Function showState_onready()
> > IF myImgID.readyState = "loading" then
> > myDivID.innerText = myImgID.readyState & " " & strPerventage
> > Else
> > myDivID.innerText = myImgID.readyState & " " & "100%"
> > End If
> > End Function
> > </script>
> >
> > <html>
> > <head></head>
> > <body>
> > <div id="myDivID"></div>
> > <img id="myImgID" src="img.jpg"
> > onreadystatechange="vbscript:showState_onready('') " />
> > </body>
> > </html>
> >
> > i'm trying to display the image amount of the file loaded in
> > percentage,
> > how do i do it?
> >

>
> IE doesn't expose info on the current progress of an image download. All
> you get is a few changes in state when the download starts to received data
> and when the data had complete arrived. You get nothing in between.
>
> The best you can do is guestimate the time involved in the download and use
> a window.interval to call an update progress function. In this function
> test the readyState of the image if still loading update your progress info
> based on time elapsed otherwise set progress to 100% and kill the interval
> handle.


Hi Anthony Jones,


i'm not clear with this:

> The best you can do is guestimate the time involved in the download and use
> a window.interval to call an update progress function. In this function
> test the readyState of the image if still loading update your progress info
> based on time elapsed otherwise set progress to 100% and kill the interval
> handle.


do you have an example for this: guestimate the time involved, usage of
window.interval ?

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
best practice of querying amout of tree organized data senges Java 0 03-24-2007 02:03 AM
java -verbose doesn't show "loaded from" for classes loaded from custom jars in the classpath Udo Corban Java 0 01-23-2004 09:32 AM
font size as a percentage of the parent should get smaller shouldn't it? David Graham HTML 2 11-06-2003 09:51 AM
Re: how to programatically give assembly loaded from network the same trust as those loaded from local host? Marcelo Birnbach [MS] ASP .Net 0 06-27-2003 11:51 PM



Advertisments