Yet another Mac and IE javascript problem.

V

Vernon Peppers

I know that there are already a bunch of these requests in the
newsgroup, but no one has answered one that would help me. I have a
site that uses Javascript, http://www.namemaker.com, and one of my
pages doesn't work properly. To view the page, go to the site, select
"100% Woven labels", and select one of the "Buy" buttons. This brings
you to the color selection screen. I have script functions so that
when the user clicks a color, the script puts a box around the user's
choice, and sets the hidden field to the chosen color. It works on
PC's IE and NS. It works on Mac's, NS. On Mac's with IE, nothing
happens when you click (or so I assume from the error reports that the
users send.)

The code that does this is:

<script language="javascript">
<!--
var a, b, c, key;
a={
0:'cream',
1:'white',
2:'pink',
3:'yellow',
4:'lightgray',
5:'lightblue',
6:'lightred',
7:'lightgreen',
8:'navy',
9:'black',
10:'redwine',
11:'darkgreen',
12:'darkgray'};
b={
0:'tbrown',
1:'tred',
2:'tblack',
3:'tgreen',
4:'trose',
5:'tnavy',
6:'tgoldmetallic',
7:'tgoldenyellow',
8:'tsilver',
9:'tviolet',
10:'twhite',
11:'tgray',
12:'tskyblue'};
c={
0:'No',
1:'No',
2:'Yes',
3:'No',
4:'No',
5:'Yes',
6:'No',
7:'No',
8:'No',
9:'No',
10:'No',
11:'No',
12:'No'};
function ProcessBackground(itemNo, ColorName, Dark)
{
for (key in a)
{
cellObj=document.getElementById(a[key]);
if (key==itemNo)
cellObj.style.borderWidth = 2;
else
cellObj.style.borderWidth = 0;
}
document.forms[0].BackgroundColor.value=ColorName;
for (key in b)
{
cellObj=document.getElementById(b[key]);
if ((Dark=='Yes') && (c[key]=='Yes'))
{
cellObj.style.visibility='hidden';
if (cellObj.style.borderWidth=='2px')
{
cellObj.style.borderWidth = 0;
r=ProcessText(0, 'Brown');
}
}
else
cellObj.style.visibility='visible';
}
return;
}
function ProcessText(itemNo, ColorName)
{
for (key in b)
{
cellObj=document.getElementById(b[key]);
if (cellObj.style.visibility=='visible')
{
if (key==itemNo)
cellObj.style.borderWidth = 2;
else
cellObj.style.borderWidth = 0;
}
}
document.forms[0].TextColor.value=ColorName;
return;
}

-->
</script>

How can I fix this problem? I have no Mac to test this with.
 
E

ExGuardianReader

Vernon said:
I know that there are already a bunch of these requests in the
newsgroup, but no one has answered one that would help me. I have a
site that uses Javascript, http://www.namemaker.com, and one of my
pages doesn't work properly. To view the page, go to the site, select
"100% Woven labels", and select one of the "Buy" buttons. This brings
you to the color selection screen. I have script functions so that
when the user clicks a color, the script puts a box around the user's
choice, and sets the hidden field to the chosen color. It works on
PC's IE and NS. It works on Mac's, NS. On Mac's with IE, nothing
happens when you click (or so I assume from the error reports that the
users send.)

The code that does this is:

<script language="javascript">
<!--
var a, b, c, key;
a={
0:'cream',
1:'white',
2:'pink',
3:'yellow',
4:'lightgray',
5:'lightblue',
6:'lightred',
7:'lightgreen',
8:'navy',
9:'black',
10:'redwine',
11:'darkgreen',
12:'darkgray'};

You are creating properties, and accessing them with array notation.

I'm not saying that's definitely the problem, I don't have a Mac but
that's weird. Why aren't you using Arrays?

var a = ["cream", "white", "pink" ...];
var b = ["foo", "bar"...];

Documentation:
http://devedge.netscape.com/library/manuals/2000/javascript/1.5/guide/ident.html#1011655

Nige
 
V

Vernon Peppers

ExGuardianReader said:
Vernon said:
I know that there are already a bunch of these requests in the
newsgroup, but no one has answered one that would help me. I have a
site that uses Javascript, http://www.namemaker.com, and one of my
pages doesn't work properly. To view the page, go to the site, select
"100% Woven labels", and select one of the "Buy" buttons. This brings
you to the color selection screen. I have script functions so that
when the user clicks a color, the script puts a box around the user's
choice, and sets the hidden field to the chosen color. It works on
PC's IE and NS. It works on Mac's, NS. On Mac's with IE, nothing
happens when you click (or so I assume from the error reports that the
users send.)

The code that does this is:

<script language="javascript">
<!--
var a, b, c, key;
a={
0:'cream',
1:'white',
2:'pink',
3:'yellow',
4:'lightgray',
5:'lightblue',
6:'lightred',
7:'lightgreen',
8:'navy',
9:'black',
10:'redwine',
11:'darkgreen',
12:'darkgray'};

You are creating properties, and accessing them with array notation.

I'm not saying that's definitely the problem, I don't have a Mac but
that's weird. Why aren't you using Arrays?

var a = ["cream", "white", "pink" ...];
var b = ["foo", "bar"...];

Documentation:
http://devedge.netscape.com/library/manuals/2000/javascript/1.5/guide/ident.html#1011655

Nige

I'm not using arrays because I am a newbie at Javascript, and I found
an example of how to do this on the web. I just used it and it seemed
to work. Thanks for the tip. I'll look into it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,828
Latest member
LauraCastr

Latest Threads

Top