Write a function that responds to a click anywhere on the
page by displaying an alert dialog. Display the event name
if the user held Shift during the mouse click. Display the
element name that triggered the event if the user held Ctrl
during the mouse click. (Answer in Java Language)
Answer Posted / anil
<html>
<head>
<title>Mouse Events Example</title>
<script type="text/javascript">
function handleEvent(oEvent) {
var oTextbox = document.getElementById("txt1");
oTextbox.value += "\n button down is " +
oEvent.button;
var arrKeys = [];
if (oEvent.ctrlKey) {
arrKeys.push("Ctrl");
}
oTextbox.value += "\n keys down are " + arrKeys;
}
</script>
</head>
<body>
<P>Use your mouse to click and double click the red square.</p>
<div style="width: 100px; height: 100px; background-color: red"
onclick="handleEvent(event)"
id="div1"></div>
<P><textarea id="txt1" rows="15" cols="50"></textarea></p>
</body>
</html>
| Is This Answer Correct ? | 14 Yes | 13 No |
Post New Answer View All Answers
What is the difference between while & do while loop
explain software engineering practices
Hi manikandhan, my name is ruby. Can u pls forward the conduct/character certificate on my Id. ruby_cse07@yahoo.co.in what details shall i require for this certificate. pls help me out with this..its really very urgent.. let me know soon bcoz my interview is on 19th septemper in mumbai...
Explain about a light bulb
Hi i'm richa piplani applied for ATC(IT) if u have the syllabus & old question papers forward me.I will be very much thankful to you. piplani.richa@gmail.com and sonu_pips@yahoo.co.in
How do you reset or reseed the IDENTITY column?
How to score well in examination of MCA(engg) december 2012? please reply soon........
how to delete four out of five duplicate records in a table using sql
what the bridge id of any switches
Please send me Sample papers National Informatics Centre (NIC) Programmer. I am giving this paper first time..so if any one have previous question papers send to manoj200.yadav@gmail.com. thnx in advance
What is HPLC ? and define it.
write an algorithm in O(n) time for finding the kth smaalest element form an array of n elements , where n and k are entered by user
tell the function of Source record of DNS server. why we create Stub zone? Tell Round Robing also?
hi i have selected for nda and could please send me the courses offered in nda regarding engineering and all other courses????
i m a student of 4th year ,i m unable to get the embassy appointment dates , and it details.............please help any body.My id=john_searching143@yahoo.com