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)
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / 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 |
i want to know details about SBI bank exam and date when to apply and what is the eligibility and the model papers related to it and various post available for Engineering in Information Technology.
i need to alone print a number no text by using if statement .say some idea
if your monitor is not started with your cpu, but start when monitor attach to another cpu then where is the problem?
anybody, Please send me the NIC(scientific officer/programmer) model questions papers to this mail id:imtiyazahamed14@gmail.com
how can i install windows-xp operating system in single time to 50 computersconnected in a LAN.
When a new build comes what is the first step taken by a tester in testing
How to trouble of routing protocol like EIGRP and OSPF
what is c dot
why bin folder is not be created in windows os?
what is buffer solution?
Guys! I coplted 10th with 80% and +2 with 64% now am dng c.s.e b.tech...i want to go abroad for higher studies i want to write tofel...plZ GIVE UR SUGGESTIONS!
when load increase in generator in island mode, why turbine rpm is reduced