Problem with JavaScript compatibility effect background disco (works on IE but not FF)

This is the code:

r = 255;
g = 255;
b = 255;
flag = 0;
t = new Array;
o = new Array;
d = new Array;

function hex (a, c)
{
t [a] = math. Floor(c/16)
o [a] = c % 16
switch (t [a])
{
case 10:
t [a] = « A » ;
break;
case 11:
t [a] = « B » ;
break;
case 12:
t [a] = « C » ;
break;
box 13:
[a] = t ';
break;
case No. 14:
t [a] = « E » ;
break;
box 15:
t [a] = « F » ;
break;
by default:
break;
}
switch (o [a])
{
case 10:
o [a] = « A » ;
break;
case 11:
o [a] = « B » ;
break;
case 12:
o [a] = « C » ;
break;
box 13:
o [a] = ';
break;
case No. 14:
o [a] = « E » ;
break;
box 15:
o [a] = « F » ;
break;
by default:
break;
}
}

function ran (a, c)
{
If ((Math.Random () > 2/3 || c == 0) & & c < 255)
{
c ++
d [a] = 2;
}
on the other
{
If ((Math.Random () < = 1/2 || c == 255) & & c > 0)
{
c-
d [a] = 1;
}
any other [a] d = 0;
}
return of c
}
function do_it (a, c)
{
If ((d [a] == 2 & & c < 255) | c == 0)
{
c ++
d [a] = 2
}
on the other
If ((d [a] == 1 & & c > 0) | c == 255)
{
c-- ;
d [a] = 1;
}
If (a is 3)
{
If (d [1] == 0 & & d [2] == 0 & & d [3] == 0)
flag = 1
}
return of c
}
function disco()
{
If (flag == 0)
{
r = a (1, r);
g = ran (2 g);
b = ran (3, b);
hex(1,r)
hex(2,g)
hex(3,b)
document. Body.style.Background = "#" + t [1] + o [1] + t [2] + o [2] + t [3] + o [3]
flag = 50
}
on the other
{
r = do_it (1, r)
g = do_it(2,g)
b = do_it(3,b)
hex(1,r)
hex(2,g)
hex(3,b)
document. Body.style.Background = "#" + t [1] + o [1] + t [2] + o [2] + t [3] + o [3]
flag-
}

setTimeout ('disco ()', 50)
}

Can someone please tell me how to make it work in Firefox, too, because I'm designing a website for which I would love to put this as a background, but if I do, it must be compatible with all major browsers.

Seems to work here. Be careful when using % in c-> c 16% 16%. Otherwise %16 maybe get unescaped.

data:text/html;charset=utf-8,
<html>
<head>
<script>
var r=255,g=255,b=255,flag=0,t=new Array,o=new Array,d=new Array;

function hex(a,c) {
t[a]=Math.floor(c/16);o[a]=c % 16;
switch (t[a]) {
case 10:t[a]='A';break;
case 11:t[a]='B';break;
case 12:t[a]='C';break;
case 13:t[a]='D';break;
case 14:t[a]='E';break;
case 15:t[a]='F';break;
default:break;
}
switch (o[a]) {
case 10:o[a]='A';break;
case 11:o[a]='B';break;
case 12:o[a]='C';break;
case 13:o[a]='D';break;
case 14:o[a]='E';break;
case 15:o[a]='F';break;
default:break;
}
}

function ran(a,c) {
if ((Math.random()> 2/3 || c==0) && c<255){c++;d[a]=2;}
else{if ((Math.random() <= 1/2 || c==255) && c>0){c--;d[a]=1;}else d[a]=0;}
return c
}

function do_it(a,c) {
if ((d[a]==2 && c<255)|| c==0){c++;d[a]=2;}
else if ((d[a]==1 && c>0) || c==255){c--;d[a]=1;}
if (a==3) {if (d[1]==0 && d[2]==0 && d[3]==0)flag=1;}
return c
}

function disco() {
if (flag==0) {
r=ran(1, r);g=ran(2, g);b=ran(3, b);
hex(1,r);hex(2,g);hex(3,b);
document.body.style.background="#"+t[1]+o[1]+t[2]+o[2]+t[3]+o[3];
flag=50;
}
else {
r=do_it(1, r);g=do_it(2,g);b=do_it(3,b);
hex(1,r);hex(2,g);hex(3,b);
document.body.style.background="#"+t[1]+o[1]+t[2]+o[2]+t[3]+o[3];
flag--;
}
setTimeout('disco()',50);
}
</script>
</head>
<body style="height:100%;" onload="disco();">
</body>
</html>

Tags: Firefox

Similar Questions

  • Weird problem with the file to the desktop, cannot be deleted, but not ro.

    Have this file of someone on a Yahoo Group, there was supposed to be a list of some articles of the hobby for sale. Do not remember how I downloaded it, e-mail, group, its Web site. Name is "the N - 2 Locomotives surplus" without extension.

    The file appears on my desktop. Properties indicate that it is of length zero. It cannot be deleted, renamed, moved, whatever it is. The error is still the same - file cannot read from the source file or disk. It's as if she's not here.

    I was even able to create a file with the same name on the desktop. It didn't crush it, it's right there next to each other. Norton doesn't pick up on it.

    I want to delete this guy, it makes me crazy. It seems to violate what I know about the files. What is c? How can I he kill?

    Unlocker:
    http://ccollomb.free.fr/Unlocker/ Bruce Hagen MS - MVP [Mail]

  • Problems with the images displayed in the document... but not errors

    Hello
    I created a download page for CFFile simple within the administration of a content management system, that I built. I am able to download image files in a directory image designated without error.

    < cffile action = "upload" accept = ' image/jpg, image/jpeg, image/gif, image/png' nameconflict = "makeunique" filefield = destination 'imagefile' = "" / > "

    In a separate area of the CMS I use to display and select the images in the directory < directory cf >.

    < cfdirectory action = "list" directory = "" name = "rsImages" type = "name" filter = "*.jpg" / > "

    Everything seems great and I get no errors. The images are actually transferred to the web server, but they do not appear in the document. No errors, if. I'm completely stumped. I have tried several things without success. Any help is greatly appreciated.

    Thank you
    Luis

    Look at the HTML source of the page. Make a copy of the image URL in a separate window. You can view the image?

    http://yoursite.com/images/staff/someImageFile.jpg

  • problem of installing active sync 6.1 64-bit with active sync. you have a known issue with the compatibility. you have a work around where the way to get these two together?

    problem of installing active sync 6.1 64-bit with active sync.  you have a known issue with the compatibility. you have a work around where the way to get these two together?

    See: http://answers.microsoft.com/en-us/winphone/forum/wp6n-sync/microsoft-windows-mobile-device-center-61-driver/4cd26ba2-9583-47b7-b5e7-32b382cee0b2

  • Problems with the lighting effects filter

    I have problems with the lighting effects filter, I can use it on photographs, but the filter option is inactive on others, advice?

    This filter only works on images of 8 bits, not on 16 bit. Could it be the problem?

  • my iPhone 6s has problems with the GPS when I use some applications, it does not work well and give especially the bad road. Can someone help me?

    my iPhone 6s has problems with the GPS when I use some applications, it does not work well and give especially the bad road. Can someone help me?

    My iphone 6 has started having the same problem. Its literally the GPS. Saying that it does not find me at all. Ive seen say location for more than an hour in the suburbs of chicago. It started to happen to me after I downloaded the latest update for the iphone. I hope they react and let you know what is happening because I'm dying to know as well.

  • Why my email say 'sorry, there is a problem with Hotmail now. We are working hard to fix, but it may take a little time yet. »

    Why my email say 'sorry, there is a problem with Hotmail now. We are working hard to fix, but it may take a little time yet. »

    Hello

    The question you posted would be better suited to Windows Live Solution Center. I suggest you to send your application in the Windows Live Solution Center for better support.
     
    http://windowslivehelp.com/product.aspx?ProductID=1

  • Why do I get the message saying: "there was a problem with windows, which caused it stop working properly.."?

    When I close the ms word document I have thi above message. -.

    Download updates for

    There was a problem with that caused it to stop working correctly.

    Your computer may run out of updates that can help improve its stability and security.

    Go online to search for and install the Important updates and recommended.

    1. Click here to access the Windows Update Web site online

    2. In the left pane, click check for updates. If updates are found, click view available updates.

    3. Select all important updates and then click install. If you are prompted for an administrator password or a confirmation, type the password or provide confirmation.

      Note
      If you have activated the automatic update, you can not see important updates listed. If this is the case, the updates have already been downloaded to your computer.

    More information

    Please explain and help understand and solve the problem.

    To learn more about updating your computer, go to the Microsoft site and read the following article:

    Windows Update frequently asked Questions

    Hi nandiniatmasiddha,

    1. did you of recent changes on the computer?

    2. you only receive the error message when closing Word document?

    3. do you have security software installed on the computer?

    I suggest that you check and install the updates that are available on the computer, including Microsoft office updates and check if it helps.

    How will I know if my computer is up to date?

    http://Windows.Microsoft.com/en-us/Windows-Vista/how-can-I-tell-if-my-computer-is-up-to-date

    Updates: frequently asked questions

    http://Windows.Microsoft.com/en-us/Windows-Vista/updates-frequently-asked-questions

    If you still get the error message when the Word document is closed then I would suggest that you post your question in the forums of Microsoft office by using the link below.

    http://answers.Microsoft.com/en-us/Office/Forum/Word

  • I am having major problems with my emails. I can send emails OK but I can't receive them. I use Outlook Express.

    I am having major problems with my emails.  I can send emails OK but I can't receive them.  I use Outlook Express.  When I first turn on outlook express, emails start coming, but then outlook express crashes.  I disable outlook express and start again. My emails are stuck in the Orange webmail box until the last email is downloaded.  This means that I sometimes get the same time to send four or five. I called technical support Orange several times, but they say it's a problem of microsoft. I use Windows XP.

    original title: I can't receive emails from outlook express.

    Hi Mike,.

    Make sure that you have not activated your antivirus software analysis of electronic mail.  See www.oehelp.com/OETips.aspx#3 which is often a problem with receiving and sending a message.

    Then, try to go to file | Identities and setup a new identity.  This will give you a new message store and a new registry hive (where all the settings and account info is).  Add your email account and see if it works very well.  If it sticks sometimes, make sure that you are not setting to check messages too often (like every 3 minutes or somesuch).  You can also try to increase the timeout for the server where this is a problem (Tools |) Accounts | Mail | Properties | Advanced).  See if who deals with issues "" OE gel.  If Yes, then you can use the file | Import | Messages to bring them from the old identity.

    I do not know that moving to Outlook might solve the problem, because they both use the same mechanism to retrieve messages.  If you still have problems, come on and generate a log file and when OE freezes, which could give some indication of what is the underlying problem.  Make sure that you disable the log file later, because this file grows enormously and can cause problems if it becomes too large.

    Steve

  • I keep having a problem with this error message. Firefox is already running but is not responding. To open a new window, you must first close the existing Firefox process, or restart your system. I've tried everything.

    I keep having a problem with this error message. Firefox is already running but is not responding. To open a new window, you must first close the existing Firefox process, or restart your system. I tried everything the internet suggested but it continues to wreak havoc... Help, please... John.I cannot give other details that it has become very annoying

    See "hang out":

  • I have currently problems with control panel Nvidia causing black outs and computer freezing/not not be able to start.

    I have currently problems with control panel Nvidia causing black outs and computer freezing/not not be able to start.

    1) update your nVidia/software drivers to the latest version for your model video card + operating system.

    (2) check that the equipment is not defective.

    This is not a Microsoft / number of the operating system.  For additional troubleshooting - contact the manufacturer (nVidia).

  • IM problems with my wireless connection, it says my DNS server does not respond, what is this, can help to somone, thanks

    IM problems with my wireless connection, it says my DNS server does not respond, what is this, can help to somone, thanks

    Hello

     

    Thanks for posting the question in the Microsoft Community!

    You can't use the wireless connection and the message that the DNS server is not responding.

    The problem may occur if the computer is unable to connect to the DNS server.

    To check, I suggest you follow the steps:

    Method 1: Re-register the DNS

     

    a. Click Start. Type cmd in the search box and press ENTER.

    b. at the command prompt, type the following command and press ENTER:
    ipconfig/flushdns (there is a space between ipconfig and /)

    It will display the message properly emptied the cache of DNS resolution.

    c. at the command prompt, type the following command and press ENTER:
    ipconfig/registerdns (there is a space between ipconfig and /)

    d. at the command prompt, type the following command and press ENTER:

    ipconfig/all (there is a space between ipconfig and /)
    The command ipconfig/all command displays for all your network adapters, TCP/IP in Windows settings.

    If your IP address of your Local network connection is 0.0.0.0 or 169.x.x.x (where x is a number any), then your computer does not receive an IP address from router.
    If this is the case, try this:

    i. enough at the command prompt ipconfig and press ENTER

    II. ipconfig / renew in command prompt and press ENTER

    The test again by typing ipconfig/all to see what is the address? (If you are on a router, it should start by or 192.168.0.x or 192.168.1.x 10.x.x.x)

    Method 2:

    a. click Start and then click Control Panel.

    b. go to the networking and sharing Center and then click on change adapter settings.

    c. right-click on connection to the Local network and select Properties.

    d. Select Internet Protocol Version 6, and then click Properties.

    e. choose the DNS server to obtain an address automatically , then press Ok.

    f. Select obtain IP address automatically.

    g. Repeat steps for Internet Protocol version 4 as well.

    http://social.answers.Microsoft.com/forums/en-us/w7network/thread/2e81fca4-35bb-4af9-86a1-7326d2fe91b3

     

    I hope this helps. If the problem persists, or if you have problems of Windows in the future, let us know and we would be happy to help you.

     

  • Spry ToolTip works in IE but not Firefox

    Hello

    I do not understand or cannot know what I did wrong. I created a ToolTip for the manufacture of the last product (diameter of 4 inches (special order) brass water revitalizer) on page: http://www.alivewater.net/order.htm

    It works in IE but not Firefox... I can't understand why... can you help me and see what I did wrong?

    Eternally grateful,

    Starry

    The biggest problem I see with the page is that there is no defined document type.  This means browsers have to guess what validation to use to guess what effects should arrive.  If you click on edit->-> category title/encoding Page Properties, you must define the Document Type (DTD).  I.e. once set DW will define the type of document for you.  You can then save and re-upload your document and we can see if the same problem persists.

  • reCAPTCHA works in IE8, but not in Firefox - missing graphics

    reCAPTCHA works in IE8, but not in Firefox

    All the graphics, the challenge, radio buttons and logo do not appear.

    Make sure that you are not blocking JavaScript.

    Start Firefox in Firefox to solve the issues in Safe Mode to check if one of the Add-ons is the cause of the problem (switch to the DEFAULT theme: Tools > Modules > themes).

    • Makes no changes on the start safe mode window.

    See:

    See also:

  • Satellite L40-15B - WiFi works at home but not at school

    My daughter has satellite worked at home and at school: wifi OK, internet OK. The satellite crashed: hard disk failure. Bought a new hard drive.

    I reset the Satellite via the recovery CD. It is now a new clean system with * Windows Vista home premium *. * Wifi works immediately at home. Internet too, but at school with my daughter, the wifi is NOT working anymore.*
    Laptops from other children at school always work with wifi.

    A college of my work told me his sister had exactly the same problem!

    Help!

    Hello

    If the WIFI connection works at home but not at school it has nothing to do with Toshiba. I think that your daughter should ask the administrator of the school what is the problem. Maybe the WLAN requires a certain configuration of TCP/IP or else I n t he know and I think that no one here can answer this question.

    Is that wireless network card is properly installed and works, because you can access the Internet at home.

    Sorry, but everything that s what I can say.

Maybe you are looking for