Trap JS events within an Object Tag

Hello, I have a html like this

<object id="UploadControl" width="100%" height="100%" classid="clsid:1E2941E3-8E63-11D4-9D5A-00902742D6E0" codebase="<<some .cab file>> Version=5,0,3,0">
<param name="SampeName" value="1">
<<... other params come here>>
</object>

This tag is primarily used in a mail application to display attachments in that mail. When a user double-clicks on one of the attachments, I want to be able to trap that event and display a custom alert. Currently, the attachment opens up using it's respective application. I am not able to prevent it from going to the application and instead display a custom message. I have tried giving 'onLoad' events on the object tag, a div tag that encloses it, on the body tag. Also tried this

<script language=javascript for="UploadControl" event="onfocus">
alert('handler comes here');
</script>

but all in vain. Could someone please help me with idea(s) to trap the javascript events on an Object tag with code base for an ActiveX control?
shyam619Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NushiCommented:
hi there.

i havent tried it with object but you can do the following:

<div onclick="alert('....')">
  <object .... >
</div>

now when the user clicks on something inside the object it should trap the mouse event.
there can be some exceptions:

whne you click on a button the button i dont know the sequesnce
it will execute the onclick.


another solution (not recommanded) is to capture mouse event
in the document and then see if the source is the object.

document.onclick = new function(){
                                                         if ( get Source based on browser == object element)  
                                                              alert('a')
                                                      }


Nushi.



0
NushiCommented:
the problem is that object is a seperate application so my guess that
the solution i gave you above will not work, but you still can give it a shot.
0
shyam619Author Commented:
Thanks Nushi. I have already tried the div tag approach. It is not working. Anything on the div, it displays the alert alright. But inside the object tag even though it is part of the div too, it fails to catch the event.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

shyam619Author Commented:
Also, I have a script like this to find out the source of the event. This does not work either.

<SCRIPT LANGUAGE="JavaScript">

function click()
{
alert('entered function for click');
  if(event.button == 0)
  {
    alert(event.button);
    alert(event.srcElement.tagName);
    alert(event.srcElement.name);
  }
  return false;
}

document.getElementById('div name here').ondblclick=click;
</SCRIPT>
0
NushiCommented:
Thats what i thought.
Object is an ActiveX which is independed.

what im tring to say is that Object doesnt have option to capture event unless
its part of the control.
whenever object is located inside the HTML its "capture" its own space
in which user/code can't get to it.

as far as i know there isnt any solution.

Nushi.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jaysolomonCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: Nushi {http:#9686101}

Please leave any comments here within the next four days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jAy
EE Cleanup Volunteer
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.