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
how the parting surface is selected in injection mould
what is the need of constractor explain with sutable progarmming example
What is RAC?(Real Application Cluster).Explain in Detail.
how to delete four out of five duplicate records in a table using sql
successful command to make linux system as router in redhat-+
What is the difference between CD-R and CD+R?
how can read number 1 to 100,without use anyloop.
If i update, insert or delete records in my view will it affect my base table?????
I am from B.Tech back ground, i had Applied to do masters in Engineering management, and university gave Admission and sent I-20, if the interviewer asks why are doing masters in this field, even you are from B.Tech (information technology)? Can any one give me relevant answer, if interviewer asks that question
assemblies in .net
i can access command prompt in my pc. when i type cmd in run,message comes-you are restricted.contact admin. why is it so? how can acces it by just logging in as a user and not as admin.?????
write a pgm to accept an array of names & name & check whether the name is present in the array. return the count of occurance. use following array as input; {"Dave","Ann","dev","merry"}
A polynomials in mamory can be represented by____________
what are the advantages and disadvantages of extended vlan (range 1006-4094)?
i want to know how can i divide the bandwidth among two computers.say i have a connection of 256 kbps dsl connection. i have a switch.now i want to divide this 256 kbps in two 128,128 equal connections.so that both of us can work on our separate 128 speed