Programmatically fire onChange() event in Netscape

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

    Programmatically fire onChange() event in Netscape

    Hi,

    I want to programatically fire an event. I have it working in IE, but
    Netscape won't work. What is the Netscape equivalent to, or a
    workaround for:

    document.myForm .myField.onchan ge();

    I've read many posts, but none seem to answer my question. Anyway, my
    example follows.

    Thanks!


    <HTML>
    <HEAD>
    <SCRIPT language=JavaSc ript>
    // <!--
    function MyFunction()
    {
    alert('MyFuncti on() fired');
    // do something...
    }

    function onload()
    {
    alert('onload() fired');
    ------------>> document.myForm .mySelectList.o nchange();
    ------------>> WHAT IS THE NETSCAPE EQUIVALENT TO THIS? This works in
    IE.
    }
    // -->
    </SCRIPT>
    </HEAD>

    <body onload="onload( )">
    <form name="myForm" method="post" action="http://www.myPage.com" >
    ...
    <select name="mySelectL ist" id="mySelectLis t"
    onChange="MyFun ction()">
    <option>
    <option value="A">blah blah blah</option>
    <option value="B">blah blah blah</option>
    </select>
    ...
    </form>
    </body>

    </HTML>
  • Martin Honnen

    #2
    Re: Programmaticall y fire onChange() event in Netscape



    Robbie wrote:

    [color=blue]
    > I want to programatically fire an event. I have it working in IE, but
    > Netscape won't work. What is the Netscape equivalent to, or a
    > workaround for:
    >
    > document.myForm .myField.onchan ge();[/color]

    That is correct and works in Netscape, the problem is elsewhere, see below.

    [color=blue]
    > <HTML>
    > <HEAD>
    > <SCRIPT language=JavaSc ript>
    > // <!--
    > function MyFunction()
    > {
    > alert('MyFuncti on() fired');
    > // do something...
    > }
    >
    > function onload()[/color]

    Change the name of that function something different to onload, for instance
    function loadHandler ()[color=blue]
    > {
    > alert('onload() fired');
    > ------------>> document.myForm .mySelectList.o nchange();
    > ------------>> WHAT IS THE NETSCAPE EQUIVALENT TO THIS? This works in
    > IE.
    > }
    > // -->
    > </SCRIPT>
    > </HEAD>
    >
    > <body onload="onload( )">[/color]

    then call
    <body onload="loadHan dler();">
    here and it will work.



    --

    Martin Honnen


    Comment

    • Robbie

      #3
      Re: Programmaticall y fire onChange() event in Netscape

      Martin Honnen <mahotrash@yaho o.de> wrote in message news:<40f6b6e0$ 1@olaf.komtel.n et>...[color=blue]
      > Robbie wrote:
      >
      >[color=green]
      > > I want to programatically fire an event. I have it working in IE, but
      > > Netscape won't work. What is the Netscape equivalent to, or a
      > > workaround for:
      > >
      > > document.myForm .myField.onchan ge();[/color]
      >
      > That is correct and works in Netscape, the problem is elsewhere, see below.
      >
      >[color=green]
      > > <HTML>
      > > <HEAD>
      > > <SCRIPT language=JavaSc ript>
      > > // <!--
      > > function MyFunction()
      > > {
      > > alert('MyFuncti on() fired');
      > > // do something...
      > > }
      > >
      > > function onload()[/color]
      >
      > Change the name of that function something different to onload, for instance
      > function loadHandler ()[color=green]
      > > {
      > > alert('onload() fired');
      > > ------------>> document.myForm .mySelectList.o nchange();
      > > ------------>> WHAT IS THE NETSCAPE EQUIVALENT TO THIS? This works in
      > > IE.
      > > }
      > > // -->
      > > </SCRIPT>
      > > </HEAD>
      > >
      > > <body onload="onload( )">[/color]
      >
      > then call
      > <body onload="loadHan dler();">
      > here and it will work.[/color]


      THANKS! THAT DID THE TRICK!!!

      Comment

      Working...