Convert IE JS to Netscape

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Need More Challenge

    #1

    Convert IE JS to Netscape

    Hi,

    I have a nice cascading menu i am trying to get to work in NS.

    My intention is to slowly pick through the code converting it function by
    function, looking for help here on specifics. Is that a good approach? or
    should I post all my code?

    For example, for starters The following works in IE, but I don't know how to
    port it to NS:

    bar[i].onmouseover = new Function("ShowM enu_NAV(" + bar[i].id + ")")
    bar[i].onclick = new Function("Do_NA V("+bar[i].id+")")


    Can you help me?

    Thanx.


  • Brian

    #2
    Re: Convert IE JS to Netscape


    "Need More Challenge" <nospam@bbbbbbb b.com> wrote in message[color=blue]
    > Hi,
    >
    > I have a nice cascading menu i am trying to get to work in NS.
    >
    > My intention is to slowly pick through the code converting it function by
    > function, looking for help here on specifics. Is that a good approach? or
    > should I post all my code?
    >
    > For example, for starters The following works in IE, but I don't know how[/color]
    to[color=blue]
    > port it to NS:
    >
    > bar[i].onmouseover = new Function("ShowM enu_NAV(" + bar[i].id + ")")
    > bar[i].onclick = new Function("Do_NA V("+bar[i].id+")")
    >
    >
    > Can you help me?
    >
    > Thanx.
    >
    >[/color]

    I think this should do it for you (havent tested it)... and it will work on
    both browsers....

    bar[i] = "ShowMenu_N av(" + bar[i].id + ")";

    As a higher level answer, you should try to port IE code to be as cross
    platform as possible. There should be very little or no IE specific or NS
    specific code when you finish.

    B


    Comment

    • Lasse Reichstein Nielsen

      #3
      Re: Convert IE JS to Netscape

      "Need More Challenge" <nospam@bbbbbbb b.com> writes:
      [color=blue]
      > I have a nice cascading menu i am trying to get to work in NS.[/color]

      I'll assume you mean Netscape 6+, not Netscape 4.
      [color=blue]
      > My intention is to slowly pick through the code converting it function by
      > function, looking for help here on specifics. Is that a good approach? or
      > should I post all my code?
      >
      > For example, for starters The following works in IE, but I don't know how to
      > port it to NS:
      >
      > bar[i].onmouseover = new Function("ShowM enu_NAV(" + bar[i].id + ")")[/color]

      If "bar[i].id" evaluates to the name "someId", you are creating a
      function with the following body:
      ShowMenu_NAV(so meId)
      When evaluated, "someId" is a variable. In IE, named elements creates
      a global variable of the same name. Not so in Mozilla/Netscape. You
      would want something like:
      ShowMenu_NAV(do cument.getEleme ntById("someId" ));
      which can be created by:
      new Function("ShowM enu_NAV(documen t.getElementByI d(\""+bar[i].id+"\"))")
      [color=blue]
      > bar[i].onclick = new Function("Do_NA V("+bar[i].id+")")[/color]

      ditto.

      /L
      --
      Lasse Reichstein Nielsen - lrn@hotpop.com
      DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
      'Faith without judgement merely degrades the spirit divine.'

      Comment

      • Lee

        #4
        Re: Convert IE JS to Netscape

        Brian said:[color=blue]
        >
        >
        >"Need More Challenge" <nospam@bbbbbbb b.com> wrote in message[color=green]
        >> Hi,
        >>
        >> I have a nice cascading menu i am trying to get to work in NS.
        >>
        >> My intention is to slowly pick through the code converting it function by
        >> function, looking for help here on specifics. Is that a good approach? or
        >> should I post all my code?
        >>
        >> For example, for starters The following works in IE, but I don't know how[/color]
        >to[color=green]
        >> port it to NS:
        >>
        >> bar[i].onmouseover = new Function("ShowM enu_NAV(" + bar[i].id + ")")
        >> bar[i].onclick = new Function("Do_NA V("+bar[i].id+")")
        >>
        >>
        >> Can you help me?
        >>
        >> Thanx.
        >>
        >>[/color]
        >
        >I think this should do it for you (havent tested it)... and it will work on
        >both browsers....
        >
        >bar[i] = "ShowMenu_N av(" + bar[i].id + ")";[/color]

        No. Even assuming you meant:
        bar[i].onmouseover = "ShowMenu_N av(" + bar[i].id + ")";
        that just assigns the string value, not a Function object.

        Comment

        Working...