archimede
12-25-2004, 07:37 AM
I am trying to create an Event to add it to a html tag. I thought that the
answer was createEvent("MouseEvents") but it was not the case. createEvent doesn't work the same way as a createElement. It simulate an event but don't write the event.
What I am looking for is a function wich has the ability to write the event
as such:
el=CreateEvent("mousedown")
el.eventFunction="abc(z,y,x)"
HTMLelement("mydiv").append(el)
and the result must be as such <div id="mydiv" onmousedown="abc(x,y,z)">
</div>
addEventListener doesn't help me because we can not add the function
(this) and if we made a save of the complete page we see that the event was not written. In the case of createElement the object would have been
written in the page. The other problem with addEventListener, it executes
once we call it.
I know that for the Java DOM there is object.setEvent("onclick", "abc(this") )
I am looking for something which is able to write the script
"physically" on the page. In such way when you save the page you can find
the information you have created.
What I am looking is a kind of setAttribute because all the code
which refer to UIEvent, dispatchEvent, initEvent, initMouseEvent... manage
the behavior of the event virtually and the creatEvent doesn't write the
event it is more like a punctual event.
I hope I succeeded to make myself understand.
would someone have an Idea
Thanks in advance
happy hollidays
archimede
answer was createEvent("MouseEvents") but it was not the case. createEvent doesn't work the same way as a createElement. It simulate an event but don't write the event.
What I am looking for is a function wich has the ability to write the event
as such:
el=CreateEvent("mousedown")
el.eventFunction="abc(z,y,x)"
HTMLelement("mydiv").append(el)
and the result must be as such <div id="mydiv" onmousedown="abc(x,y,z)">
</div>
addEventListener doesn't help me because we can not add the function
(this) and if we made a save of the complete page we see that the event was not written. In the case of createElement the object would have been
written in the page. The other problem with addEventListener, it executes
once we call it.
I know that for the Java DOM there is object.setEvent("onclick", "abc(this") )
I am looking for something which is able to write the script
"physically" on the page. In such way when you save the page you can find
the information you have created.
What I am looking is a kind of setAttribute because all the code
which refer to UIEvent, dispatchEvent, initEvent, initMouseEvent... manage
the behavior of the event virtually and the creatEvent doesn't write the
event it is more like a punctual event.
I hope I succeeded to make myself understand.
would someone have an Idea
Thanks in advance
happy hollidays
archimede