Tricky javascript/activex object problem

J

joebob

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>
 
G

Grant Wagner

joebob said:
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>

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 <[email protected]>

* Client-side Javascript and Netscape 4 DOM Reference available
at:
*
http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_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-developer/upgrade_2.html
 
G

Grant Wagner

joebob said:
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

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 <[email protected]>

* Client-side Javascript and Netscape 4 DOM Reference available
at:
*
http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_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-developer/upgrade_2.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top