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


Please Help Members By Posting Answers For Below Questions

what is the working of tcp/ip?

1540


What is the key element of Defect Report and Test case format?

1179


what things abutsbi

1569


Iam preparing for Visakhapatnam Management Trainee 2009 entrance exam.. If anybody have Visakhapatnam Management Trainee Interview questions Pls forward to my mail id srikanth.avanthi@gmail.com .. It is kindly request..

1430


hi, i applied for AIRPORTS AUTHORITY OF INDIA for the post of AIR TRAFFIC CONTROLLER(ATC)..so plz send me the sample questions to my id...88arun@gmail.com

1634






plz explain abt refrigeration r22 bitzer comprassors trouble shooting and maintenance

1355


Hi, I am appearing for the ISRO exam for the post of Scientist/ Engineer to be held on 26th April,09. Can anyone help me regarding the same? I want to know about the exam pattern and the syllabus. If anyone could share your experience or sample papers for the same at khadhar786@rediffmail.com? It would be very useful for me. Thanks.

1662


hai iam selected in po exam in allahabad bank . my interview date is 02-06-2009. so plese send me some sample question on my email. my email is nitinbikhani@yahoo.com

1377


computer is male or female.....???

1448


A family, planning a weekend trip, decides to spend not more than a total of 8 hours driving. By leaving early in the morning, they can average 40 miles per hour on the way to their destination. Due to the heavy Sunday traffic, they can average only 30 miles per hour on the return trip. What is the farthest distance from home they can plan to go? (EXPLAIN WITH PROPER STEPS)

2934


Whay we use gigabite ethernt

1782


4. What is your typical way of dealing with conflict?

1425


what is the Relationship between quantity of Gas and capacity of AC machine in tonnage.

1661


write a c program which accept input as:Anu.B.Kapur and give out as:Kapur.A.B using pointers

1281


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,

1855