473,883 Members | 1,570 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Handling ActiveX events in JavaScript (Internet Explorer)


I'm trying to handle events raising by Microsoft ActiveX Spreadsheet
I use following code to include this control into page:

<object classid="clsid: 0002E551-0000-0000-C000-000000000046"
id="Spreadsheet 1"">


Than i'm trying to handle onclick event by following code:

Spreadsheet1.on click = function() {

This code has no effect -- no alert message, but no error message. But
the following code:

Spreadsheet1.cl ick = function() {

raises error "object doesn't support this action". This means, that
onclick event is khown by javascript. But by using VBScript I can hanle
onclick event,
this code works right:

Sub Spreadsheet1_cl ick()
alert Spreadsheet1.ce lls(5,4).value
End Sub

Does anybode have experience in catching activeX events by JS?

Oct 24 '05 #1
3 19044

<SCRIPT FOR="Spreadshee t1" EVENT="click()" LANGUAGE="Jscri pt">

This code works as I wanted.

Oct 24 '05 #2
kl**********@gm ail.com wrote:

<SCRIPT FOR="Spreadshee t1" EVENT="click()" LANGUAGE="Jscri pt">

This code works as I wanted.
Using a 'for' attribute on a script element to add it to an element is
an 'IE-ism' that will only work in IE.

Likely your page only works in IE anyway, but for the record some
cross-browser ways of adding the onclick to the object element are to
either add it inline, directly in the <object> HTML source tag:

<object classid="clsid: 0002E551-0000-0000-C000-000000000046"
id="Spreadsheet 1"
onclick="alert( 1)";...</object>

or add it dynamically after the object has been created:

<object id="Spreadsheet 1"...>...</object>

<script type="text/javascript">
var el;
if (document.getEl ementById){
el = document.getEle mentById('Sprea dsheet1');
} else if (document.all){
el = document.all['Spreadsheet1'];
el.onclick = function(){aler t(1);};

If you don't need to support old IE, document.all bit can be removed.
Check out the group FAQ for various options:

<URL:http://www.jibbering.c om/faq/#FAQ4_15>

Oct 24 '05 #3
RobG said the following on 10/24/2005 5:05 PM:
kl**********@gm ail.com wrote:

<SCRIPT FOR="Spreadshee t1" EVENT="click()" LANGUAGE="Jscri pt">

This code works as I wanted.

Using a 'for' attribute on a script element to add it to an element is
an 'IE-ism' that will only work in IE.

I doubt that an ActiveX Control controlling a Spreadsheet control will
working anything *but* IE so using IE-only code is not a problem.

comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Oct 24 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: wang xiaoyu | last post by:
Hello: i want use activex in wxpython program,but when i use MakeActiveXClass an exception occurs. this is my source code dealing the DICOM ocx.I must note that in this program "hwtxcontrol" is a ocx developed my me use vc6,this ocx works fine in wxpython. but you can see i only change this ocx with a new DICOM ocx and set up eventClass,
by: Jeff M | last post by:
For my application an activeX refers to "program displayed within Internet Explorer" After looking over the docs for VB.NET it looks impossible. ---START--- USERCONTROL CHANGES IN VISUAL BASIC .NET In Visual Basic 6.0, UserControl projects (also known as ActiveX Control projects) were used to create ActiveX controls. After they were compiled,
by: Fie Fie Niles | last post by:
This one XP machine (with IE 6) is having a problem viewing any ActiveX controls (created on VB6) on the Internet Explorer browser. I put the same ActiveX control in a VB program, and when I run the VB program on that same machine, I can view the ActiveX control fine. He is using Citrix. The same ActiveX controls can be viewed on other machines. When trying to view 1 of the ActiveX control, he got an error "Visual Basic Run-time redist...
by: joebob | last post by:
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()">
by: A.M. | last post by:
Hi at all, how can I do to insert into a HTML page a file .txt stored in the same directory of the server where is the html file that must display the text file.txt? Thank you very much P.Pietro
by: EJ1003 | last post by:
Hello I would like to create Activex Control uisng C# and use it in ASP.Net webform. User Control is not solving my requirement so I am going for Activex Control. Please guide me on this, how to do it, if any sample is provided will be of great help Thanks EJ
by: Klaus Jensen | last post by:
Hi! I would like to build a small application, that should be embedded in a webpage. I want to develop it using VB.Net of course, and have the usual opportunities of a windows app... A common example of such an app would be an image upload control, like the ones used at hotmail communities (and yahoo I think), many online photo-services.
by: Apu Nahasapeemapetilon | last post by:
Hello and thank you in advance for your help. Can anyone think of a reason why this code would work properly on one PC, but not another? I've got a System.Windows.Forms.UserControl that products events which I want to consume (sink) within Internet Explorer. I'm following the instructions at: ms-http://support.microsoft.com/default.aspx?kbid=313891.
by: Adam Clauss | last post by:
We have created an ActiveX control (a series of them actually) which can be loaded into Internet Explorer and accessed via Javascript using the techniques described here: http://support.microsoft.com/kb/555687/en-us Functionally, everything is working as we expect. We can access the C# data we need from Javascript, including firing C# events which invoke Javascript code. However, we started seeing that, should we leave the...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.