Yet another Mac and IE javascript problem.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Vernon Peppers

    Yet another Mac and IE javascript problem.

    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="javas cript">
    <!--
    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:'tgoldmetalli c',
    7:'tgoldenyello w',
    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 ProcessBackgrou nd(itemNo, ColorName, Dark)
    {
    for (key in a)
    {
    cellObj=documen t.getElementByI d(a[key]);
    if (key==itemNo)
    cellObj.style.b orderWidth = 2;
    else
    cellObj.style.b orderWidth = 0;
    }
    document.forms[0].BackgroundColo r.value=ColorNa me;
    for (key in b)
    {
    cellObj=documen t.getElementByI d(b[key]);
    if ((Dark=='Yes') && (c[key]=='Yes'))
    {
    cellObj.style.v isibility='hidd en';
    if (cellObj.style. borderWidth=='2 px')
    {
    cellObj.style.b orderWidth = 0;
    r=ProcessText(0 , 'Brown');
    }
    }
    else
    cellObj.style.v isibility='visi ble';
    }
    return;
    }
    function ProcessText(ite mNo, ColorName)
    {
    for (key in b)
    {
    cellObj=documen t.getElementByI d(b[key]);
    if (cellObj.style. visibility=='vi sible')
    {
    if (key==itemNo)
    cellObj.style.b orderWidth = 2;
    else
    cellObj.style.b orderWidth = 0;
    }
    }
    document.forms[0].TextColor.valu e=ColorName;
    return;
    }

    -->
    </script>

    How can I fix this problem? I have no Mac to test this with.
  • Jeff Thies

    #2
    Re: Yet another Mac and IE javascript problem.

    > I know that there are already a bunch of these requests in the[color=blue]
    > 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.)[/color]

    I didn't fire up my Mac, but...

    Does nothing in NS7.1 and throws object expected errors in IE5

    The html is funky:

    <font><a .....></font></a> improperly nested

    also:

    id="Light Redt" I don't think spaces are permitted in id's

    So's the inline CSS:

    style="border-style: solid; border-width: 1"> That needs a unit (px), if
    it's nonzero. Ditto with providing the unit for the javascript:

    cellObj.style.b orderWidth = 2;


    Jeff[color=blue]
    >
    > The code that does this is:
    >
    > <script language="javas cript">
    > <!--
    > 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:'tgoldmetalli c',
    > 7:'tgoldenyello w',
    > 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 ProcessBackgrou nd(itemNo, ColorName, Dark)
    > {
    > for (key in a)
    > {
    > cellObj=documen t.getElementByI d(a[key]);
    > if (key==itemNo)
    > cellObj.style.b orderWidth = 2;
    > else
    > cellObj.style.b orderWidth = 0;
    > }
    > document.forms[0].BackgroundColo r.value=ColorNa me;
    > for (key in b)
    > {
    > cellObj=documen t.getElementByI d(b[key]);
    > if ((Dark=='Yes') && (c[key]=='Yes'))
    > {
    > cellObj.style.v isibility='hidd en';
    > if (cellObj.style. borderWidth=='2 px')
    > {
    > cellObj.style.b orderWidth = 0;
    > r=ProcessText(0 , 'Brown');
    > }
    > }
    > else
    > cellObj.style.v isibility='visi ble';
    > }
    > return;
    > }
    > function ProcessText(ite mNo, ColorName)
    > {
    > for (key in b)
    > {
    > cellObj=documen t.getElementByI d(b[key]);
    > if (cellObj.style. visibility=='vi sible')
    > {
    > if (key==itemNo)
    > cellObj.style.b orderWidth = 2;
    > else
    > cellObj.style.b orderWidth = 0;
    > }
    > }
    > document.forms[0].TextColor.valu e=ColorName;
    > return;
    > }
    >
    > -->
    > </script>
    >
    > How can I fix this problem? I have no Mac to test this with.[/color]


    Comment

    • ExGuardianReader

      #3
      Re: Yet another Mac and IE javascript problem.

      Vernon Peppers wrote:
      [color=blue]
      > 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="javas cript">
      > <!--
      > 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'};[/color]

      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:


      Nige

      Comment

      • Vernon Peppers

        #4
        Re: Yet another Mac and IE javascript problem.

        ExGuardianReade r <noway@noway.co m> wrote in message news:<bvfr76$21 h$1@hercules.bt internet.com>.. .[color=blue]
        > Vernon Peppers wrote:
        >[color=green]
        > > 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="javas cript">
        > > <!--
        > > 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'};[/color]
        >
        > 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/...t.html#1011655
        >
        > Nige[/color]

        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.

        Comment

        Working...