473,396 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

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?

Nov 3 '06 #1
4 3983

"thisis" <he******@web.dewrote in message
news:11**********************@e3g2000cwe.googlegro 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.
Nov 3 '06 #2

Anthony Jones wrote:
"thisis" <he******@web.dewrote in message
news:11**********************@e3g2000cwe.googlegro 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.

Nov 3 '06 #3
>

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?

Nov 3 '06 #4

Anthony Jones wrote:
"thisis" <he******@web.dewrote in message
news:11**********************@e3g2000cwe.googlegro 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 ?

Nov 4 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Bill Burwell | last post by:
I am converting a VB6 WebClass application to VB.Net. Used the VB upgrade tool to do the conversion - and it left me a lot of little code things to do. Did those code things and got my app to...
14
by: Frances Del Rio | last post by:
if (parent.frames.main.location == 'mediaselect.html') { I have a very simple frameset, name of frame where I'm checking is 'main'... why is this not working? I mean this is correct syntax,...
3
by: Les Juby | last post by:
I am trying to adjust the window/table size of a website (www.worklaw.co.za) which has made use of DIV tags with its settings embedded in an CSS file. The client wants its width and height to...
22
by: Les Juby | last post by:
I am trying to adjust the window/table size of a website (www.worklaw.co.za) which has made use of DIV tags with its settings embedded in an CSS file. The client wants its width and height to...
0
by: fake ID | last post by:
Since you can't search for these symbols used in asp.net "<%#" or '<%=' I thought i'd post this to make things a little easier to find. Potential search word combinations: -lessthan Percentage...
5
by: James Conrad StJohn Foreman | last post by:
Have found http://www-128.ibm.com/developerworks/db2/library/techarticle/lyle/0110lyle.html which is quite helpful, but doesn't quite tell me what I want. I have a table, advertising_spend with...
9
by: Jordan Pittman | last post by:
ok i want to wait an x amout of seconds before my ajax script writes the results to a div, but i want it to still display the loading bar, i do have a variable http_rste that holds the readyState...
2
by: Zach | last post by:
I compiled a game client and it crashed (segmentation fault) resulting in a core file being generated. I'm trying to find out exactly what caused it to crash. Any ideas how I can do this with gdb?...
5
by: Aswanth | last post by:
I'm Using Asp.Net with C# & Working with SSRS 2005 for Generating Reports.. The Following Expression I'm using in Reports to Show the Percentage of Particular Items in REPORT.. ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.