magicyte

07-03-2008, 05:12 PM

Help is urgent!!! I created a JavaScript code the other day, and I have no idea what is wrong with it. When I opened it up in my IE 4 internet browser, there was an error. I double-clicked on the little exclaimation point error thingy in the bottom left-hand corner. A new window opened and said that there was an error on line 36. I don't know what is wrong. Here is the code, though I have only accomplished a little:

<html>

<head>

<script language="JavaScript">

var r = 255;

var b = 255;

var g = 255;

var b1 = 11111111;

var b2 = 11111111;

var b3 = 11111111;

var hex = "FFFFFF";

function b0()

{

r = document.getElementById('r1').value;

b = document.getElementById('b1').value;

g = document.getElementById('g1').value;

}

function d1()

{

var c1 = 1;

var c2 = 1;

var c3 = 1;

var c4 = 1;

var c5 = 1;

var c6 = 1;

var c7 = 1;

var c8 = 1;

var result = 255;

if((result-128) > 0)

{

c1 = "1";

result -= 128;

}

else

{

c1 = "0";

result = result;

}

if((result-64) > 0))

{

c2 = "1";

result -= 64;

}

else

{

c2 = "0";

result = result;

}

if((result-32) > 0))

{

c3 = "1";

result -= 32;

}

else

{

c3 = "0";

result = result;

}

if((result-16) > 0))

{

c4 = "1";

result -= 16;

}

else

{

c4 = "0";

result = result;

}

if((result-8) > 0))

{

c5 = "1";

result -= 8;

}

else

{

c5 = "0";

result = result;

}

if((result-4) > 0))

{

c6 = "1";

result -= 4;

}

else

{

c6 = "0";

result = result;

}

if((result-2) > 0))

{

c7 = "1";

result -= 2;

}

else

{

c7 = "0";

result = result;

}

if((result-1) > 0))

{

c8 = "1";

result -= 1;

}

else

{

c8 = "0";

result = result;

}

alert(c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8);

}

function d2()

{

}

function d3()

{

}

function ch()

{

}

function change()

{

document.getElementById('bg').style.background=hex;

}

</script>

</head>

<body onload="d1()" id="bg">

<INPUT TYPE="text" MAXLENGTH="6" id=color

onkeydown="change()" onkeyup="change()">

</body>

</html>

If anyone could please help me and tell me what is wrong, my burden will be lifted. Very much thanks in advance!!! The only part that is being activated is my problem. It is the function d1().

-magicyte

<html>

<head>

<script language="JavaScript">

var r = 255;

var b = 255;

var g = 255;

var b1 = 11111111;

var b2 = 11111111;

var b3 = 11111111;

var hex = "FFFFFF";

function b0()

{

r = document.getElementById('r1').value;

b = document.getElementById('b1').value;

g = document.getElementById('g1').value;

}

function d1()

{

var c1 = 1;

var c2 = 1;

var c3 = 1;

var c4 = 1;

var c5 = 1;

var c6 = 1;

var c7 = 1;

var c8 = 1;

var result = 255;

if((result-128) > 0)

{

c1 = "1";

result -= 128;

}

else

{

c1 = "0";

result = result;

}

if((result-64) > 0))

{

c2 = "1";

result -= 64;

}

else

{

c2 = "0";

result = result;

}

if((result-32) > 0))

{

c3 = "1";

result -= 32;

}

else

{

c3 = "0";

result = result;

}

if((result-16) > 0))

{

c4 = "1";

result -= 16;

}

else

{

c4 = "0";

result = result;

}

if((result-8) > 0))

{

c5 = "1";

result -= 8;

}

else

{

c5 = "0";

result = result;

}

if((result-4) > 0))

{

c6 = "1";

result -= 4;

}

else

{

c6 = "0";

result = result;

}

if((result-2) > 0))

{

c7 = "1";

result -= 2;

}

else

{

c7 = "0";

result = result;

}

if((result-1) > 0))

{

c8 = "1";

result -= 1;

}

else

{

c8 = "0";

result = result;

}

alert(c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8);

}

function d2()

{

}

function d3()

{

}

function ch()

{

}

function change()

{

document.getElementById('bg').style.background=hex;

}

</script>

</head>

<body onload="d1()" id="bg">

<INPUT TYPE="text" MAXLENGTH="6" id=color

onkeydown="change()" onkeyup="change()">

</body>

</html>

If anyone could please help me and tell me what is wrong, my burden will be lifted. Very much thanks in advance!!! The only part that is being activated is my problem. It is the function d1().

-magicyte