Execution bug JavaScript setTimeout loop trying to fade.style.opacity += 0.1.

Execution bug JavaScript setTimeout loop trying to fade.style.opacity += 0.1. He works with negative = operator but not with a positive operator +=. Browser (Firefox 11) just keeps telling me that the opacity is 0.1 all the time.

Here is my code:

function setOpacity() {
	i++;
	if (dir == 1)
	{
		fade.style.opacity -= 0.1;
		if (fade.style.opacity < 0.1)
		{	dir = 0;	}
	}
	else
	{
		fade.style.opacity = fade.style.opacity + 0.1;
		if (fade.style.opacity > 0.9)
		{	dir = 1;	}
	}
	document.getElementById('opacity').innerHTML = "Opacity: " + fade.style.opacity;
	document.getElementById('dirr').innerHTML = "dir = " + dir;
	document.getElementById('i').innerHTML = "i = " + i;
	t = setTimeout("setOpacity()",100);
}

So if I change the operator += =, opacity continues to change. I am sure that the problem must be in Firefox, because with IE all kept going even with the operator +=.

The problem seems to be that the opacity value is not considered to be a float.

Use them instead:

fade.style.opacity = fade.style.opacity*1 - 0.1;
fade.style.opacity = fade.style.opacity*1 + 0.1;

You can opt for document.getElementById ('bland') instead of the identifier for fade to avoid warnings in error Console.

WARNING: The Element referenced by ID/NAME in the global scope. Use rather document.getElementById (standard) W3C.

Source file: http://greenpark.fi/js_fader.php

Online: 23

Tags: Firefox

Similar Questions

  • Is it possible to block the execution of Javascript from an IP address?

    In accordance with article http://tech.firstpost.com/news-analysis/more-trouble-for-airtel-injects-javascript-code-to-monitor-data-usage-activist-receives-notice-270111.html, my broadband provider is inserting javascript in web pages browsed by me. I would like to block the download and execution of Javascript to this IP address. is it possible to do?

    Have you tried the YesScript extension? It can block scripts by IP (or domain name).

    1. Add YesScript in Firefox.
    2 Add-ons Manager open (Ctrl + Shift + A)
    3. click on Extensions
    4. click the button Options of YesScript
    5. Add the IP address

  • How to calculate the execution time of a loop?

    Hello

    Can someone guide me that how to calculate the execution time of a loop to iterate?

    Thank you and best regards,

    Rashid

    I hope I have your question! See attached screenshot

  • How do I leave my membership? I am sent on an endless loop, trying to stop my membrrship. Help!

    I am sent on an endless loop trying to stop my subscription and or talk to customer support to stop my subscription. I do not use it. I don't want to.

    We are working on this, but there is no ETA for it right now.

    Concerning

    Stéphane

  • get a dotted line around .swf files in my flash site now. This is new from Firefox 3. With the help of 4 on a MacBookPro. tried the fix "style no outline. does not work. any help?

    Question
    get a dotted line around .swf files in my flash site now. This is new from Firefox 3. With the help of 4 on a MacBookPro. tried the fix "style no outline. does not work. any help?

    Ah, quite understand now that I added to my doc html

    < style type = "text/css" >
    {body
    background-color: #FFF;
    }
    "'object {outline: none ;}"} '

    < / style >

  • What is "fade in" and "fade out" opacity?

    What is "bland in" and "fade out" (it's in "applied effects") and how can it be used?

    Me22

    First elements 13/13.1 on Windows 7 64 bit...

    Example of what you would expect to see a bland video

    Front

    After clicking on Fade In opacity Control Panel expanded the palette of effects applied on the applied effects tab

    When I clicked Fade In, two opacity keyframes have been placed at the beginning of the rubberband timeline... Follow the rubberband (orange line) in the video clip (when the orange line is in the upper part of the frame that is 100% opacity, when inside, it's 0% opacity)... the first keyframe of opacity is automatically set to 0% opacity at the beginning of the calendar item. That's why you see a black screen with the timeline at the beginning of the timeline indicator video clip... the opacity second keyframe is automatically set 100% to 1 second from the start of the mounting clamp.

    Notice in the screenshot to 1 second, the full video is displayed. Gradually from 0 to 1 second, the view has grown from any video to full video... Fade In.

    You can move keyframes for opacity (white dots) on the timeline with the mouse cursor to change the default result to reach your 0 to 100% increase in the opacity (Fade In) somewhere else and have a different duration between 0 to 100% increase.

    Please review and take another look at the effect. So please let us know if you can get the effects of fading.

    Thank you.

    RTA

  • The mail is in a loop trying to send the same letter without success

    I have this problem, I can not send emails, any email account that I use. mail gets in a tent loop to send the same email over and over again.

    The window with the unsent mail keeps poping up and go without having me no press.

    Somoe...... Hotel details

    The goies of e-mail in the Outbox mailbox and it has not registered as sent. To stop I'm going to Outbox and delete the e-mail, then the email window appears a few times, and it stops.

    I need help!

    Somoe...... Hotel details

    I tried to restart the any and rebuild the mailboxes

  • HP 8710p BIOS could not update - now infinite LOOP - trying to find - please help!

    Hey all. I've updated my friends to f.20 bios system - and it now appears that the bios update failed, and then it restarts.

    It is an endless loop - which never lets me boot in windows - so I can't go back to a previous version of the BIOS.

    I have read around forums and discovered a method to try an emergency recovery by getting the rompaq bios and by holding down the Windows key + B when I turn on the system.

    Just buy an external USB floppy drive to try this emergency recovery.

    I tried the USB - but it wouldn't work.

    I get different results here - but not what I want.

    With the USB floppy plugged: when I press Win + B - seeing traffic flashes so far much more time, looks like it initializes the floppy drive (green light comes on for a moment) - but then nothing - just flashing caps lock for a little and then finally a restart again in the fate of loop. It never appears to start to read the diskette or find a bios file.

    What I am doing wrong? What can I try? The disc must be leabeled a certain way? Should it be renamed my BIOS file?

    Any help would be GREAT!

    I had a very similar experience.  Here is how I fixed it.

    Download sp41954.exe hereor search for it.

    Double-click the file to launch the application.  If you use Vista or later, close the program, go where he extracted (C:\swsetup\sp41954) and search for the FirmwareUpdater.exe file.  Right-click on the file and select Properties.  Click on the Compatibility tab and select "run this program in compatibility mode for: Windows XP (Service Pack 3).  Open FirmwareUpdater.exe and create a startup disk.  If you are using XP, you can create the sp41954 startup disk directly.

    Turn the laptop off.  Connect the floppy drive USB with the newly created on the portable computer diskette.  Hold all four arrows while turning on the laptop.  Continue to hold down the four arrows until you see the num-lock or flashing caps lock key (don't remember which).  He should be reading the disk.  After a minute or two, the laptop should restart and operate normally.

    When I did, I disconnected the laptop and removed the battery.  I don't know if it was necessary to remove all or not.

    I hope this helps.

  • How to use Javascript to loop through a tabular presentation

    APEX: 4.2.3

    DB: 11 GR 2

    Requirement:

    I have a master form / retail. We will see that master is the order information; Detail is the order lines. Detailed form is tabular

    The detailed form, there is an attribute called 'Line Order Qty' and the user can update this field.

    User can update all rows in the detail forms and change "line Order Qty' for each line. When the user click on 'Save' button on Master form, I have to do below:

    Sum of the 'line Order Qty' for all lines, and compare it to another field called 'Plan Order Qty' on the master shape.

    If sum 'Line Order Qty' > "Plan Order Qty", then it should appear a message with "Are you sure?" with two buttons on the message: OK and cancel.

    If users click on 'OK', the application will proceed and update another field called 'Sum of Order Qty' on the main form and the value set for the sum of "Online Order Qty" for all lines;

    If the user clikc 'Cancel', the application will be paused. The user must come back to change "Line Order Qty", and then try again

    given, I need a popup message when the validation, I think I have to write javascript; However, in the javascript code, I need complete all lines in detail (tabular form) to get the

    The sum of the 'line Order Qty'. Then I can compare the value and to launch the pop message if validation has failed?

    By reading this thread: building the perfect beast: Oracle APEX - Soft Validation using dynamic measurements

    I think I need to create a reference for action (DA) dymaic Javascript expression; However, in Javascript, how do I browse a table?

    Yet once, I need an example of using Javascript to browse tabular forms in the form master / detail.

    I don't know that my question should be raised before; but I can't find a good match of thread.

    Thank you!

    Kevin

    Hi Kevin Zhang,

    Sum of the 'line Order Qty' for all lines, and compare it to another field called 'Plan Order Qty' on the master shape.

    If sum 'Line Order Qty' > "Plan Order Qty", then it should appear a message with "Are you sure?" with two buttons on the message: OK and cancel.

    If users click on 'OK', the application will proceed and update another field called 'Sum of Order Qty' on the main form and the value set for the sum of "Online Order Qty" for all lines;

    If the user clikc 'Cancel', the application will be paused. The user must come back to change "Line Order Qty", and then try again

    given, I need a popup message when the validation, I think I have to write javascript; However, in the javascript code, I need complete all lines in detail (tabular form) to get the

    The sum of the 'line Order Qty'. Then I can compare the value and to launch the pop message if validation has failed?

    Follow the steps below

    Step 1: Change your page - > function and declaration of the Global Variable-> to insert the code below

    (i) f06 is here, the column on which I am looping the f06 column and enters the total variable to the value change in the values of the row that is changed by the user.

    (II) also replace your column with f06 markup on which you want to loop and calculate the total

    (III) assuming that P6_ITEM is the point where you plan_order_qty, replace with your article.

    (IV) SAVE this demand is what happens when OK is clicked, assign the request to process.which you give the floor to a click of the button SAVE the

    function update_order_qty () {
      var line_order_qty_tot = 0;
      $("input[name='f06']").each(function() {
        line_order_qty_tot += parseFloat($(this).val().replace(/,/g,''))||0;
      });
    
      var plan_order_qty = apex.item( "P6_ITEM" ).getValue()
    
      if (line_order_qty_tot > plan_order_qty) {
          apex.confirm('Are you sure?', 'SAVE');
      } else {
          apex.submit( 'SAVE' );
      }
    }
    

    Step 2: Edit the page-> Execute when loading the page-> to insert the code below

    \\calculate the total on change
       $("input[name='f06']").change(function(){update_order_qt();})
    

    Step 3: Change your button Save and put under the Action when the button is clicked

    Action: Redirect URL

    Target URL:

    javascript:update_order_qty();
    

    Hope this helps you,

    Kind regards

    Jitendra

  • Bug JavaScript when browsing Stock

    Hello

    Whenever I start looking for Adobe Stock photos I get this error:

    Script: resource://gre/modules/commonj...nsion/data/mutation-summary.js:598

    I have to stop a javascript to be able to continue, but she does whenever I go to a new page or enter a new period of research. My browser freeze shortly and then I have to stop the script. It is very boring and tedious when browsing. I encounter this problem in firefox.

    Have you tried another browser or clear the memory cache on your browser?

  • Stuck in a loop trying to cancel my subscription to the CC

    Hey,.

    I am trying to cancel my subscription to creative cloud I was a student of the year last but now work in a studio with full access to creative cloud so no more need a personal copy. The page "Contact Customer Care" is just to send me into an infinite loop and I can't understand how to cancel. I keep following the instructions, but come to a dead end. I don't see any option to communicate with someone to talk to.

    Screen Shot 2015-09-30 at 09.49.39.png

    I am connected, but not always seeing no option 'phone or cat' below. Any help would be appreciated.

    See you soon!

    Hello

    Please visit https://helpx.adobe.com/x-productkb/global/phone-support-orders.html

    Hope that helps!

    Kind regards

    Sheena

  • infinite loop trying to buy

    When trying to register for the annual plan of paid monthly photography I am sent in a loop to enter my card details after confirmation of. No error message, just send at the beginning again.

    Trying to register from Japan, with a VISA card.

    A way to solve this problem, or at least to know what is the problem?

    To place the order, please contact customer service

    You can use: http://helpx.adobe.com/x-productkb/global/phone-support-orders.html

  • JavaScript for loop to execute Advanced Actions - execute Javascript does not?

    I use a loop to check the value of a Cookie.  When I add this using Execute Javascript it works fine but I want to run with certain other actions, if I want to use Of execute advanced Actions. When I add this coded to an action to run Javascript in the breast to perform advanced Actions code disappeared if I open the Script window again once.  I try to remove the code for loop in bold below and then the remaining code remains.  So I think that the problem must be with the loop for, but I don't see anything wrong with this code and I have, as I said that this code works fine if I use Javascript to run on its own. I've attached a video clip below to show what I mean.

    var task1_value = readCookie ("task1");

    function readCookie (name) {}

    var nameEQ = name + '=';

    var CA = document.cookie.split(';');

    for (var i = 0; i < ca.length; i ++) {}

    var c = ca [i];

    even if (c.charAt (0) ==' ') c = c.substring(1,c.length);

    If (c.indexOf (nameEQ) == 0) return c.substring (nameEQ.length, c.length);

    }

    Returns a null value.

    }

    I found that window JavaScript of CP does not like loops.

    Your best bet is to put the function in an external JS file from the top of the page. I always run scripts in an external file. Really helps debug that you do not have to republish Captivate. Just change your code and refresh the browser. If you use external file you can store all your functions there.

    I would also look into using the local storage instead of cookies. Very easy to implement and you can store a ton of information.

    Local storage - dive into HTML5

  • loop of music fade out by the button between scenes


    Hello

    I have an infinite loop of music and I try to have the btn_start to trigger a fade on the music as well as its origin gotoAndPlay.

    I have two scenes, 'opening' and 'animation '. btn_start and the following code are in the stage of "openness".

    the fade out will play as well as the first couple of "animation" seconds since the gotoAndPlay connects to frame 1 of the 'animation '.

    Is this possible? Please show me some lights how do this.

    Stop();

    import flash.net.URLRequest;
    import flash.media.Sound;

    var url: URLRequest = new URLRequest ("subtle.mp3");
    var snd:Sound = new Sound (url);
    SND. Play (0: 17);

    btn_start.addEventListener (MouseEvent.MOUSE_DOWN, mouseDownHandler);
    function mouseDownHandler(event:MouseEvent):void {}

    gotoAndPlay (1, "animation");

    }

    Thank you!!

    You can use:

    Stop();

    import flash.net.URLRequest;
    import flash.media.Sound;

    var fadeRate:Number is. 01;  number between 0 and 1.  the closer to 1, faster the fade

    var url: URLRequest = new URLRequest ("subtle.mp3");
    var snd:Sound = new Sound (url);
    var sc:SoundChannel = snd.play (0, 17);

    btn_start.addEventListener (MouseEvent.MOUSE_DOWN, mouseDownHandler);
    function mouseDownHandler(event:MouseEvent):void {}
    this.addEventListener (Event.ENTER_FRAME, fadesoundF);
    gotoAndPlay (1, "animation");

    }

    function fadesoundF(e:Event):void {}

    var st:SoundTransform = sc.soundTransform;

    St.volume = fadeRate;

    If (st.volume<>

    this.removeEventListener (Event.ENTER_FRAME, fadesoundF);

    }

    sc.soundTransform = st;

    }

  • upgrade from trial in an infinite loop trying to upgrade Mac Pro

    trying to upgrade 10.11.1 in 10.11.2.  Click "update", pop-up choice is "restart" and "later".   makes no difference, what option is taken - restart time, click on restart or later - the lancers of logic, a dialog box stating "updates have changed" with the options of the "Cancel" button and "details".  both button give options that the same result-> nothing happens.  manual restart of apple does not level.  manualling download the upgrade, the only way to work around this problem?

    manualling download the upgrade, the only way to work around this problem?

    Not the only way, but the easiest way.

Maybe you are looking for

  • I have 100 GB of 'other' on my startup disk; What is c?

    I get a message on the diskette of starting being full.  When I look at what's on the disc I see that another category has 115 GB which is more than my big photo library and video library.  What is this 'other' and how best to deal with it?

  • Tablets with digitizer pens (Android)

    Hello Are there more tablets with digitizer pens available or soon available?I only know: Lenovo Thinkpad Tablet? New Version of the Tablet from Lenovo?HTC Flyer 7 "HTC Jet stream HTC Evo view 7 "(thx pghFL)"Samsung Galaxy Note 5.3 "(thx katyatraore)

  • E5 - 573G laptop 56RG breaks down when you try to play a game with the Nvidia GeForce 940 M processor.

    Whenever I try to play a game using the Nvidia card on the laptop Aspire E5 56RG - 573 G computer goes to a blue screen and gives the error "Video_Schedular_Internal_error" before restarting. All the games that I tried to run by using the processor 9

  • Not audio and video transfer

    I'm transferring my Sony Digital 8 camcorder in Movie Maker. The audio is not that crosses when the video is in the Capture or the finished film. Sony support said that an Audio Codec must be downloaded. Stick211

  • BlackBerry Smartphones rejecting PIN asking to enter 'blackberry '.

    Hi guys... I have a problem on my new (three months) 9000 "BOLD" which is actually a repetition of a similar problem I had on a previous model. One of the children was playing with the phone when it was locked - are not uncommon! When I went to use (