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
can u tell me placement peoceduers and placemnt format of hpcl.
hiiiiiiii to all am going to prepare J.T.O (BSNL)posts am studying B.Tech final year cse........ but its all about electronic subjects....so tell me where can i get previous papers? give me some sites plzzzzzz.........
I need to know the process to add 100 tapes in ATL. Ho to inicialize them to the system? How is all the process i need to follow> Thanks
Explain how to share outlook calenders and the type of permissions you need to assign?
How do an incremental process model and certification work together to produce high quality software? In your own words, describe the intent of certification in the clean room software engineering context.
what is difference between shell commands and shell scripting commands or both r same?
how to send request to the direct server rather than proxy server
what is a query for divide a table into two subtable?
what are register variables?what are the advantages of using register variables in c language?
Three pc now connected the 24 port switch.one pc ip adders 192.168.0.125,anather pc ip is 192.168.0.98, anather pc ip is 192.168.0.123, so 98 or 125 ping replay to 123,but 123 is not replay 125 or 98, but 123 is others pc ping replay,
HI i have 2 year manual testing exp from MNC in pune but due to some reason i am looking job in testing . Friends hepl me to get the job i am not getting calls. alim24@gmail.com.09860643281
how to make resume and what should I include in it?
how will u send the idoc
what is difference between class and object in c++
is the RKDF university is aicte approved for b.tech in computer