Thanks to all
Yes, my first response was before I really looked at the code and I missed the last function. In fact, I could not use that approach exactly because I had to assign the same handler to many elements. Instead, I decided to cache the reference to object itself on the document...
My problem is this. I create a javascript object
that has a function associated with it. I instantiate this object and when it is instantiated, it assigns its function as an onclick handler to a div element on the page.
Here is a simple html that I created to demonstrate the problem...
Sorry vbkris, as I said, the html code is not under my control. I write the JS function to serve a general purpose and work on images identified by their id's, no matter how they are embedded in their html page.
The suggestion by vongrunt seems to be the right solution. Thanks, I'll try it.
Thanks, but this won't work. The parent node may include much more than just the image, and this is not under my control. For example, in the following, the parent is a <td> element but there is much more than the image inside.
<td><a>some link</a><img src = someSource propertyA =...
I have an IMG "myImage" object which I want to copy into a div element "myDiv". It is very simple in IE
myDiv.innerHTML = myImage.outerHTML
Netscape does not support outerHTML. How can I do the same in Netscape?
Thanks
Funny, adding ondragstart="return(false);" to the image cancels the appearance of the the "No Entry" cursor form but it does not solve the problem. The onmouseover on the other image is still not triggered.
Thanks to all of you trying to help.
I managed to reduce the problem to one simple question - why onmouseover event on one image is not triggered when you click first on another image.
Here is a very simple HTML page (you'll have to provide two images of your own)
<html>
<head>
<script>...
Hi Tviman
Thanks for trying to help.
Unfortunately, I have to insist that this is the right way to assign handler programtically. Javascript consider functions as variables of object type and what you call a variable name is exacltly that, the function object is a variable.
Try it and you see...
Well, unfortunately, this is the right way to do it. When you assign an handler programtically this way, you cannot pass parameters (a known limitation). Also, you should not include the parenthesis, just the function name.
I'll try to present the problem in the most simple form:
I have an array of elements on the page - "elmts". I have another element "controller" with a onmousedown handler that sets a mouseover event on "elmts". For simplicity, the mouseover function just displays a message:
function...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.