Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

animated gif

Status
Not open for further replies.

VBmim

Programmer
Jun 25, 2001
361
BE
Hello

I have an intranet site that pulls data from our database with the help of remote scripting. Here is the code...

Code:
<script language=&quot;javascript&quot;>
function LoadingKnipper(show)
{
if (show == true)
PictLoading.style.display = &quot;block&quot;;
else
PictLoading.style.display = &quot;none&quot;;
}

function GetData()
{
rsFunc=RSGetASPObject(&quot;../Project/RSFunctions.ASP&quot;);
IHTML = rsFunc.FunctionPullData(text1.value).return_value;
DivWithData.innerHTML = IHTML;
}
</script>


<input id=&quot;text1&quot; name=&quot;text1&quot;><br>

<input id=&quot;button1&quot; name=&quot;Button1&quot; type=&quot;button&quot; value=&quot;Omzetten&quot; onclick=&quot;GetData();&quot; onmouseup=&quot;LoadingKnipper(false);&quot; onmousedown=LoadingKnipper(true);><br>

<IMG id=PictLoading style=&quot;DISPLAY: none&quot; height=30 src=&quot;images/loading.gif&quot; width=80 name=PictLoading><br>

<div name=&quot;DivWithData&quot; id=&quot;DivWithData&quot;></div>

When I push the button, the button stay pressed until the data is pulled. Also, when I press the button, the loading.gif appears and dissapears when the data is ready.

The problem is that loading.gif is an animated gif. When the image apears, it freeses (doesn't animate).

Is there an function or something like 'DoEvents' in Visual Basic that could help me out here?

Thanks!

Greetz

VBMim
 
Animated gifs are pretty big files, The way they tend to operate is to display the first frame as a static image while waiting for the rest of the gif to download. The fact that you're downloading other information at the same time won't help.

I'd say what's happening is your data is being returned and the picture hiding before it ever gets a chance to download fully.

Try pre-loading the image and see if that helps any... Otherwise, use a smaller image.

Never be afraid to share your dreams with the world.
There's nothing the world loves more than the taste of really sweet dreams.
 
Hello

Thanks for your fast response!

I checked and the loading.gif is 3kb, it's not that impressive, isn't it? :)

in fact, the gif loops through this:

Loading
Loading.
Loading..
Loading...
Loading
ect ect

While testing, the picture freeses on any one of the 4 possibilities (showing 'Loading.', next time showing 'Loading', next time 'Loading...', ... you get the picture)

I'll try and preload it anyway, but I don't have much hope it will work...

Greetz

VBMim
 
I had a similar problem that I posted a while back, but never got a response :(

If preloading the image works out for ya can you post a description of how that's done exactly? I'm pretty new to javascript and html.

Thanks

-kaht
 
If all your gif is doing is displaying text... can I ask why you would use a graphic at all?

Never be afraid to share your dreams with the world.
There's nothing the world loves more than the taste of really sweet dreams.
 
Put this in your page it will keep updating the word Loading with a . every 1 second. You can put a stop value in so it eventually stops, an now no need for big fat bloated ani gif

<span ID=&quot;Status&quot;>Loading </span>
<script language=&quot;javascript&quot;>
LoadText()

function LoadText()
{
Status.innerHTML = Status.innerHTML + '.';
setTimeout(&quot;LoadText()&quot;, 1000);
}
</script>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top