Connecting Tech Pros Worldwide Forums | Help | Site Map

Tricky javascript/activex object problem

joebob
Guest
 
Posts: n/a
#1: Jul 23 '05
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><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.displayFile('C:\\test.htm');
}
</script>
</body></html>

Grant Wagner
Guest
 
Posts: n/a
#2: Jul 23 '05

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.displayFile('C:\\test.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.onmousedown = function() {
if (!this.mouseDownFired) {
this.mouseDownFired = true;
// do whatever
return true;
}
return false;
}

--
| Grant Wagner <gwagner@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available
at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* 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


joebob
Guest
 
Posts: n/a
#3: Jul 23 '05

re: Tricky javascript/activex object problem


"Grant Wagner" <gwagner@agricoreunited.com> wrote in message news:40C887EE.1B9083D5@agricoreunited.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.displayFile('C:\\test.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.onmousedown = function() {
if (!this.mouseDownFired) {
this.mouseDownFired = true;
// do whatever
return true;
}
return false;
}

--
| Grant Wagner <gwagner@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available
at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* 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

joebob
Guest
 
Posts: n/a
#4: Jul 23 '05

re: Tricky javascript/activex object problem


"Grant Wagner" <gwagner@agricoreunited.com> wrote in message news:40C887EE.1B9083D5@agricoreunited.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.displayFile('C:\\test.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.onmousedown = function() {
if (!this.mouseDownFired) {
this.mouseDownFired = true;
// do whatever
return true;
}
return false;
}

--
| Grant Wagner <gwagner@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available
at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* 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

Grant Wagner
Guest
 
Posts: n/a
#5: Jul 23 '05

re: Tricky javascript/activex object problem


joebob wrote:
[color=blue]
> "Grant Wagner" <gwagner@agricoreunited.com> wrote in message
> news:40C887EE.1B9083D5@agricoreunited.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.displayFile('C:\\test.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.onmousedown = function() {
> if (!this.mouseDownFired) {
> this.mouseDownFired = 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 "onmousedown" 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="putInTa(this);">
<textarea name="output"></textarea>
</form>
<script type="text/javascript">
function putInTa(inp) {
inp.form.elements['output'].value += window.event.keyCode;
}
</script>

--
| Grant Wagner <gwagner@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available
at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* 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


Closed Thread


Similar JavaScript / Ajax / DHTML bytes