473,804 Members | 3,797 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Changing opacity using setTimeout or setInterval

34 New Member
Hi,
My sctipt not work, it can't change opacity every 0.1 second!

Expand|Select|Wrap|Line Numbers
  1. function LiveSupport() {
  2. var x = document.getElementById('c_cover');
  3. var y = document.getElementById('c_popcontent');
  4. var z;
  5. var startOpacity = '0'; //int only
  6. var endOpacity = '80'; //int only
  7. var t = 0;
  8. x.style.position = 'absolute';
  9. x.style.top = '80px';
  10. x.style.left = '50%';
  11. x.style.marginLeft = '-325px';
  12. x.style.background = '#000';
  13. x.style.zIndex = '998';
  14. x.style.height = '676px';
  15. x.style.width = '650px';
  16. x.style.opacity=startOpacity/100;
  17. x.style.filter = "alpha(opacity=" + startOpacity + ")";
  18. for (z=startOpacity; z!=endOpacity; z++) {
  19. t++;
  20. setTimeout(function () { setOpacity('c_cover', z); }, t+'0');
  21. }
  22. }
  23.  
i have alerted t, it didn't change black(the element) when it alerted(1-79), when var t was 80, it changed to opacity 0.8!, so where is 0.01-0.79???

Thanks.
Aug 30 '10 #1
4 2776
Kong Chun Ho
34 New Member
Any one have solution?
Aug 31 '10 #2
omerbutt
638 Contributor
please paste your complete code along with the html if you want someone to look at it and advise nad you have an error change this line no 17
with this one
Expand|Select|Wrap|Line Numbers
  1. x.style.filter = "alpha(opacity= " +startOpacity + ")";
  2.  
Aug 31 '10 #3
Kong Chun Ho
34 New Member
Expand|Select|Wrap|Line Numbers
  1. <div id = "contact">
  2. <p class = "heading">Contact us if you have question or you have feedback to us</p>
  3. <p class = "Subheading">Live support</p>
  4. <?
  5. $current = "http://messenger.services.live.com/users/7a2131078a356d3@apps.messenger.live.com/presenceimage?mkt=zh-tw";
  6. $current = file_get_contents($current);
  7. $online = "http://www.wlmessenger.net/static/img/presence/Online.gif";
  8. $online = file_get_contents($online);
  9. $offline = "http://www.wlmessenger.net/static/img/presence/Offline.gif";
  10. $offline = file_get_contents($offline);
  11. if($current == $online) {
  12. echo '<a href = "#" style = "color:#666;" onmouseover = "this.style.color = \'#999\'" onmouseout = "this.style.color = \'#666\';" onclick = "LiveSupport();">Live support is online, please click here to talk with our support live.</a>';
  13. }else if($current == $offline) {
  14. echo 'Live support is offline, please use helpdesk to contact support.';
  15. }
  16. ?>
  17. <p></p>
  18. <p class = "Subheading">Helpdesk</p>
  19. <p><a style = "color:#666;" onmouseover = "this.style.color = '#999'" onmouseout = "this.style.color = '#666';" href = "?a=h">Submit a ticket (Reply in 72 hour)</a></p>
  20. <p><a style = "color:#666;" onmouseover = "this.style.color = '#999'" onmouseout = "this.style.color = '#666';" href = "?a=t">Track your submitted ticket</a></p>
  21. <div id = "c_cover"></div>
  22. <div id = "c_popcontent"></div>
  23. </div>
  24.  
Aug 31 '10 #4
Kong Chun Ho
34 New Member
add &nbsp;?
non breaking space?
Aug 31 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
16112
by: Weston C | last post by:
In the course of trying to build a simple clock, I've run into a problem using the setInterval (and setTimeout) function. http://weston.canncentral.org/misc/tkeep/tkeep.html http://weston.canncentral.org/misc/tkeep/tkeep.jss function fieldToClock(fieldId) { var field = document.getElementById(fieldId); alert("Starting a clock in text field " + fieldId + "(" + field
2
1444
by: S.Hoitinga | last post by:
Hi, I am trying to create a header on a page that switches between 7 textitems in an array. using this code: <script language="JavaScript"> season=new Array("summer","winter","fall","spring",") i=0 function raise()
5
1306
by: Aamir Ghanchi | last post by:
Can anyone explain why their is no documentation for both of these funstions on the devedge.netscape.com website? TIA
3
2410
by: John Smith | last post by:
I would like to close a child window I opened from the parent using setTimout. I have the function below, but it always returns the error "sendWindow is undefined". I would appreciate any pointers. function sendWindow() { var sendWin =
1
1803
by: chris | last post by:
I've used JavaScript DOM scripting to create a table element and alter its opacity. Bizarrely, the contents of the table appear to vanish when the opacity changes. One important note is that I am using transparent PNGs as background images of elements within the table. The following CSS is used to style two elements within the table: ..arrowLeft { filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/core/images/arrow.png',
7
18120
by: James Black | last post by:
I have an object, and I define the following: var processForm=new Object(); processForm=function(inservleturl) { this.inservleturl = inservleturl; this.submitForm(); } processForm.prototype.submitForm2=function() { }
2
2044
by: Noggon | last post by:
My function, called first() keeps coming back to me in the javascript console as being undefined. Yet I can't think why it isn't loaded. Maybe I'm brain dead, so could use some help! :-) What I'm trying to do is to have functions call each other at intervals of 2 seconds, each changin a src of an image as they do so.
1
3422
by: Jeff Williams | last post by:
I have a form with several tabs and I want to dynamically change the opacity of it while shown. Is there a way to stop the form updating on screen until all controls have change opacity then allow the form to display. Lookings for something like this.SuspendUpdate then
0
10589
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10340
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10327
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7625
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5527
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4302
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3828
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2999
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.