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
please send me latest Aptitude Test paper
what is far pointer?
Do you have any tips for using 3G phones?
What is the strongest naturally occurring material and how can it be cut?
am looking for ms,i got ielts score 5.5,and i dont have english score 60 in any any year.tell me can i get offer lettr from any university.is i am elegible..?
How can I get know that my pc contains dram or sram..?
Whats the difference between following two array declaration in JAVA? int a[]={1,2,3,4,5}; int []a-{1,2,3,4,5};
An inversion is an array of numbers is any pair (i,j) such
that i
what is c dot
what are enumerations in c language?
If any kind of accident happen without any information to any one .what kind of action we have to take
I am an Electrical engineering ( electrical back round ) ,can i get hvac Water system design details to easy understand ,i am working past 15years in Pharmaceuticals company with Engineering depart.
what does the interviewer mean by saying "have a good life " cheerfully at the end of an HR interview??? is this positive to be selected reply yes or no
what are the advantages as disadvantages of the V-model?
i want a richdatatable to be displayed only when a list has some value in the bean, and a datatable with header only if the list is empty. And i want the datatable to be printed only when ajax button is clicked??