eddie wrote:
Any idea why this simple alert does not work?
It does 'work', it just doesn't do what you want it to do. But as you
are not letting on what that is you will get no closer to doing it
here.
took this straight
out of someone elses answer to my last question ...
So this had an author who you could have replied to in order to get an
answer directly?
<snip>
<div id="push" onclick="new Function('alert(this);')">
<snip>
The string value of an intrinsic event attribute in HTML is used by the
browser to create a function object (as the body source code for the
function). The function object is then assigned to a property of the
DOM element that corresponds with the element in which the attribute
was declared, and executed as a method of that element when the
pertinent event happens.
This process applied to your mark-up above is approximately equivalent
of scripting:-
referenceToDivElement.onlclick = function(event){
new Function('alert(this);');
};
- that is, the onclick handler assigned to the DIV element acts by
creating a new function object and then doing nothing with that object.
Any browser you test this with almost certainly is working exactly as
programmed, but the process programmed has no visible manifestation.
Richard.