HTML, JavaScript And CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingHTML, JavaScript And CSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old October 14th, 2009, 05:54 AM
vikasp vikasp is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 41 vikasp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 51 m 58 sec
Reputation Power: 5
Problem while show hide div

Hi Friends,

I am writing one simple program where on button click I want to show loading gif. The code is as below:
==============================================
[code]
<html>
<head>
<script language="javascript">
function showHide()
{
document.getElementById("divImage").style.display="block"
//document.getElementById("divImage").style.position = "absolute";

for (i=0;i<=5000;i++)
{
}

document.getElementById("divImage").style.display="none";
}
</script>
</head>
<body>
<div id="divImage" style="display:none"><img id="img1" src="images/ajax-loader.gif" alt="" /></div>
<input type="button" value="Refresh" ID="Button1" NAME="Button1" onClick="showHide()" />
</body>
</html>
[code/]
==============================================

Problem: After clicking the Refresh button, I never see loading gif (even after increasing the "for loop" counter).

but if I write alert function instead of for loop then it shows me loading gif.

Please suggest me way to do it wihtout alert method.

Thank You.

Regards,

Vikas

Reply With Quote
  #2  
Old October 14th, 2009, 06:56 AM
phoenix1986's Avatar
phoenix1986 phoenix1986 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2009
Location: India
Posts: 316 phoenix1986 User rank is Second Lieutenant (5000 - 10000 Reputation Level)phoenix1986 User rank is Second Lieutenant (5000 - 10000 Reputation Level)phoenix1986 User rank is Second Lieutenant (5000 - 10000 Reputation Level)phoenix1986 User rank is Second Lieutenant (5000 - 10000 Reputation Level)phoenix1986 User rank is Second Lieutenant (5000 - 10000 Reputation Level)phoenix1986 User rank is Second Lieutenant (5000 - 10000 Reputation Level)phoenix1986 User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 4 Days 23 h 41 m 46 sec
Reputation Power: 75
Send a message via Yahoo to phoenix1986
wouldn't it be better...
if you used setTimeout
which calls a function to hide the gif after the specified time... ?

edit
ie you initially call a function which shows the div and then settimeout to call a function which hides the div ?
__________________
“Life may not be the party we hoped for, but while we are here we should sing, dance and be merry all the time......."

Reply With Quote
  #3  
Old October 15th, 2009, 05:44 AM
vikasp vikasp is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 41 vikasp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 51 m 58 sec
Reputation Power: 5
Hi aashishnakra,

Thanks for suggestion. Its solve my problem.

Regards,

Vikas

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingHTML, JavaScript And CSS Help > Problem while show hide div


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump





 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek