Tricky javascript/activex object problem

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

    Tricky javascript/activex object problem

    The following script if run in Internet Explorer should
    display a thumbview of a webpage that you point it to.
    To test it, replace test.htm with a valid html file.

    The problem I'm having is that I can't get onclick to
    fire on the rendered Thumbview object. What's strange
    is that onmouseover fires. Can anyone see a way?

    <html><head><ti tle>test</title></head>
    <body onload="Init()" >
    <a onclick=alert() href="file:///C:/test.htm">
    <object id="Thumbview"
    classid="clsid: 1D2B4F40-1F10-11D1-9E88-00C04FDCAB92"
    width=120 height=100 onclick=alert() >
    </object><br><br> this works
    </a>
    <script>
    function Init(){
    Thumbview.displ ayFile('C:\\tes t.htm');
    }
    </script>
    </body></html>
  • Grant Wagner

    #2
    Re: Tricky javascript/activex object problem

    joebob wrote:
    [color=blue]
    > The following script if run in Internet Explorer shoulddisplay
    > a thumbview of a webpage that you point it to.To test it,
    > replace test.htm with a valid html file. The problem I'm having
    > is that I can't get onclick tofire on the rendered Thumbview
    > object. What's strangeis that onmouseover fires. Can anyone
    > see a way?<html><head ><title>test</title></head>
    > <body onload="Init()" >
    > <a onclick=alert() href="file:///C:/test.htm">
    > <object id="Thumbview"
    > classid="clsid: 1D2B4F40-1F10-11D1-9E88-00C04FDCAB92"
    > width=120 height=100 onclick=alert() >
    > </object><br><br> this works
    > </a>
    > <script>
    > function Init(){
    > Thumbview.displ ayFile('C:\\tes t.htm');
    > }
    > </script>
    > </body></html>[/color]

    onclick and ondblclick just aren't honored by that ActiveX
    component. You can probably get onmousedown working, you'll just
    have to set it up so that it doesn't fire repeatedly.

    Something like:

    Thumbview.onmou sedown = function() {
    if (!this.mouseDow nFired) {
    this.mouseDownF ired = true;
    // do whatever
    return true;
    }
    return false;
    }

    --
    | Grant Wagner <gwagner@agrico reunited.com>

    * Client-side Javascript and Netscape 4 DOM Reference available
    at:
    *


    * Internet Explorer DOM Reference available at:
    *
    Find official documentation, practical know-how, and expert guidance for builders working and troubleshooting in Microsoft products.


    * Netscape 6/7 DOM Reference available at:
    * http://www.mozilla.org/docs/dom/domref/
    * Tips for upgrading JavaScript for Netscape 7 / Mozilla
    * http://www.mozilla.org/docs/web-deve...upgrade_2.html


    Comment

    • joebob

      #3
      Re: Tricky javascript/activex object problem

      "Grant Wagner" <gwagner@agrico reunited.com> wrote in message news:40C887EE.1 B9083D5@agricor eunited.com...
      joebob wrote:
      [color=blue]
      > The following script if run in Internet Explorer shoulddisplay
      > a thumbview of a webpage that you point it to.To test it,
      > replace test.htm with a valid html file. The problem I'm having
      > is that I can't get onclick tofire on the rendered Thumbview
      > object. What's strangeis that onmouseover fires. Can anyone
      > see a way?<html><head ><title>test</title></head>
      > <body onload="Init()" >
      > <a onclick=alert() href="file:///C:/test.htm">
      > <object id="Thumbview"
      > classid="clsid: 1D2B4F40-1F10-11D1-9E88-00C04FDCAB92"
      > width=120 height=100 onclick=alert() >
      > </object><br><br> this works
      > </a>
      > <script>
      > function Init(){
      > Thumbview.displ ayFile('C:\\tes t.htm');
      > }
      > </script>
      > </body></html>[/color]

      onclick and ondblclick just aren't honored by that ActiveX
      component. You can probably get onmousedown working, you'll just
      have to set it up so that it doesn't fire repeatedly.

      Something like:

      Thumbview.onmou sedown = function() {
      if (!this.mouseDow nFired) {
      this.mouseDownF ired = true;
      // do whatever
      return true;
      }
      return false;
      }

      --
      | Grant Wagner <gwagner@agrico reunited.com>

      * Client-side Javascript and Netscape 4 DOM Reference available
      at:
      *


      * Internet Explorer DOM Reference available at:
      *


      * Netscape 6/7 DOM Reference available at:
      * http://www.mozilla.org/docs/dom/domref/
      * Tips for upgrading JavaScript for Netscape 7 / Mozilla
      * http://www.mozilla.org/docs/web-deve...upgrade_2.html

      Comment

      • joebob

        #4
        Re: Tricky javascript/activex object problem

        "Grant Wagner" <gwagner@agrico reunited.com> wrote in message news:40C887EE.1 B9083D5@agricor eunited.com...
        joebob wrote:
        [color=blue]
        > The following script if run in Internet Explorer shoulddisplay
        > a thumbview of a webpage that you point it to.To test it,
        > replace test.htm with a valid html file. The problem I'm having
        > is that I can't get onclick tofire on the rendered Thumbview
        > object. What's strangeis that onmouseover fires. Can anyone
        > see a way?<html><head ><title>test</title></head>
        > <body onload="Init()" >
        > <a onclick=alert() href="file:///C:/test.htm">
        > <object id="Thumbview"
        > classid="clsid: 1D2B4F40-1F10-11D1-9E88-00C04FDCAB92"
        > width=120 height=100 onclick=alert() >
        > </object><br><br> this works
        > </a>
        > <script>
        > function Init(){
        > Thumbview.displ ayFile('C:\\tes t.htm');
        > }
        > </script>
        > </body></html>[/color]

        onclick and ondblclick just aren't honored by that ActiveX
        component. You can probably get onmousedown working, you'll just
        have to set it up so that it doesn't fire repeatedly.

        Something like:

        Thumbview.onmou sedown = function() {
        if (!this.mouseDow nFired) {
        this.mouseDownF ired = true;
        // do whatever
        return true;
        }
        return false;
        }

        --
        | Grant Wagner <gwagner@agrico reunited.com>

        * Client-side Javascript and Netscape 4 DOM Reference available
        at:
        *


        * Internet Explorer DOM Reference available at:
        *


        * Netscape 6/7 DOM Reference available at:
        * http://www.mozilla.org/docs/dom/domref/
        * Tips for upgrading JavaScript for Netscape 7 / Mozilla
        * http://www.mozilla.org/docs/web-deve...upgrade_2.html


        Hi Grant,

        I discovered that onmousedown works. Also in conjunction with Overlib which is pretty cool.

        I haven't done anything to ensure that it doesn't fire repeatedly, but I haven't found that to be a problem. Can you tell me what could cause that to occur? Thank you

        Comment

        • Grant Wagner

          #5
          Re: Tricky javascript/activex object problem

          joebob wrote:
          [color=blue]
          > "Grant Wagner" <gwagner@agrico reunited.com> wrote in message
          > news:40C887EE.1 B9083D5@agricor eunited.com...
          >
          > joebob wrote:
          >[color=green]
          > > The following script if run in Internet Explorer[/color]
          > shoulddisplay[color=green]
          > > a thumbview of a webpage that you point it to.To[/color]
          > test it,[color=green]
          > > replace test.htm with a valid html file. The[/color]
          > problem I'm having[color=green]
          > > is that I can't get onclick tofire on the rendered[/color]
          > Thumbview[color=green]
          > > object. What's strangeis that onmouseover fires.[/color]
          > Can anyone[color=green]
          > > see a way?<html><head ><title>test</title></head>
          > > <body onload="Init()" >
          > > <a onclick=alert() href="file:///C:/test.htm">
          > > <object id="Thumbview"
          > >[/color]
          > classid="clsid: 1D2B4F40-1F10-11D1-9E88-00C04FDCAB92"[color=green]
          > > width=120 height=100 onclick=alert() >
          > > </object><br><br> this works
          > > </a>
          > > <script>
          > > function Init(){
          > > Thumbview.displ ayFile('C:\\tes t.htm');
          > > }
          > > </script>
          > > </body></html>[/color]
          >
          > onclick and ondblclick just aren't honored by that
          > ActiveX
          > component. You can probably get onmousedown working,
          > you'll just
          > have to set it up so that it doesn't fire repeatedly.
          >
          > Something like:
          >
          > Thumbview.onmou sedown = function() {
          > if (!this.mouseDow nFired) {
          > this.mouseDownF ired = true;
          > // do whatever
          > return true;
          > }
          > return false;
          > }
          >
          >
          > Hi Grant, I discovered that onmousedown works. Also in
          > conjunction with Overlib which is pretty cool. I haven't done
          > anything to ensure that it doesn't fire repeatedly, but I
          > haven't found that to be a problem. Can you tell me what could
          > cause that to occur? Thank you[/color]

          By "fire repeatedly" I mean that the native behavior of the
          operating system causes an event like "onmousedow n" to fire over
          and over again at say, 500ms intervals because the native
          behavior of the operating system sends an event every 500ms when
          a mouse button is held down. If the onmousedown event doesn't
          fire repeatedly if you hold the mouse button down then it's fine.
          I wasn't sure if it did. Using an alert() to test made it hard to
          determine if the event was firing repeatedly.

          Good examples of "repeatedly firing" events are "onkeydown" or
          "onkeypress ", which _do_ fire over and over again when you hold a
          key down. A simple example of this is (IE only):

          <form>
          <input type="text" onkeydown="putI nTa(this);">
          <textarea name="output"></textarea>
          </form>
          <script type="text/javascript">
          function putInTa(inp) {
          inp.form.elemen ts['output'].value += window.event.ke yCode;
          }
          </script>

          --
          | Grant Wagner <gwagner@agrico reunited.com>

          * Client-side Javascript and Netscape 4 DOM Reference available
          at:
          *


          * Internet Explorer DOM Reference available at:
          *


          * Netscape 6/7 DOM Reference available at:
          * http://www.mozilla.org/docs/dom/domref/
          * Tips for upgrading JavaScript for Netscape 7 / Mozilla
          * http://www.mozilla.org/docs/web-deve...upgrade_2.html


          Comment

          Working...