Last post Aug 14, 2008 07:17 PM by cc_nelson
Aug 12, 2008 08:46 PM|cc_nelson|LINK
The end result should look like
I need to do this when a certain user control is on the page, so it needs to happen in code.
Aug 12, 2008 10:51 PM|NHOQUE|LINK
This is an example from w3school,
var e = window.event;
targ = e.target;
else if (e.srcElement)
targ = e.srcElement;
if (targ.nodeType == 3) // defeat Safari bug
targ = targ.parentNode;
alert("You clicked on a " + tname + " element.");
<h2>This is a header</h2>
<p>This is a paragraph</p>
<img border="0" src="ball16.gif" alt="Ball">
Aug 13, 2008 07:11 PM|cc_nelson|LINK
Programmatically.... But thanks anyway.
Here is the way I found to do it, in case anyone is interested.
You have to give your html body tag an ID and a runat="server", like so -
<body id="htmlbody" runat="server">
Then in your code you can do this -
Aug 14, 2008 02:39 AM|NHOQUE|LINK
Sorry to misunderstand your question.
What is the problem if I do not register the "onMouseDown" in the above way while I can do it in a simple way,
Would you mind to explain?
So far I know, for clientside function, we need to register event for serverside elements like <asp:TextBox>, <asp:CheckBox> ....
Aug 14, 2008 04:07 PM|cc_nelson|LINK
Aug 14, 2008 04:38 PM|NC01|LINK
Or to do it client-side:
document.body.onmousedown = function ()
Aug 14, 2008 06:23 PM|cc_nelson|LINK
Aug 14, 2008 07:05 PM|NC01|LINK
I didn't test that with Firefox though, only IE 7
Aug 14, 2008 07:17 PM|cc_nelson|LINK
I see... I'll test it when I get the chance.
You have earned your MVP status nonetheless. [:D]