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 yadav
<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");
}
if (oEvent.shiftKey)
{
arrKeys.push("Shift");
}
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 ? | 5 Yes | 7 No |
Post New Answer View All Answers
hello sir,pls fdorward previous group-I exam papers .....
Please explain me gsm call scenario for a prepaid roamer calling to a prepaid roamer?
what is the difference between core java and advance java
Hi All... PLease send me if anyone have "Information Security Officer" Aptitude papers. Please Mail me at mannusanghi@gmail.com
what is the proper location of sample point for sphere tank?
how u test the idoc in inbound and outbound?
How can I get know that my pc contains dram or sram..?
Please. Does someone know how to inicialize tapes in ATL? I need have 100 tapes to init inside the ATL, how is the process to complete this request?
what are differences between composition and inheritance in c
I have file with input as below : Name Value Rohan 12,13,14 Rohit 1,2,3 Output should be : Rohan 12 Rohan 13 Rohan 14 Here how will the normalize component work? Thanks
which are the books available in, India for STONE COLUMNS/GRANULAR PILES?
If you were to drill a circular hole in a sheet of metal and then heat the sheet, what would happen to the size of the hole?
what are the artifacts in coding phase in SDLC????
what is the difference between oracle 8i vs 9i
Hi my dears I have 2 questions. 1- how many types of test are there at all? 2- how can I define test characteristics (such as test duration and parameter severity)in developing a modern technological equipment? I tanks you for introducing or sending a text handbook or guidebook file for me. thanks for your coming answers. yours sincerely