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 |
What will be the sql query to list the employee names those are getting 3rd highest salary ?
what books to prepare for atc please
hi friends i am first time using this site.i came to by some tcs personals that certifications r important for placements.i am financially average i am learning java from books.please tell is it enough if not which certification should i go for
What is mean by the error LVALUE REQUIRED in C language
what is a structure in c language?
what is the term genericity in oops?
what is the use of fact tables in your banking project doveleped with teradata?
How many rounds in dell interview process in dell
2 Answers DELL, IBM, Marvel ERP,
How To Create RAID & Troubleshoot RAID related issue.
why pegging is required for deaerator in power plant nd why maintain the constant pressure in deaerator 3.5 kg/cm2.
What will be the output of the following program : void main() { int a,b,c; scanf("%1d %2d %3d",&a,&b,&c); printf("Sum=%d",a+b+c); } [NOTE : THE USER INPUT IS :123456 44 544] (a)Sum=480 (b)Sum=594 (c)Sum=589 (d)None of these
i am shortlisted in corporation bank for the post of computer officer the next phase is group discussion. i want to know how to prepare and what about the topics for preparing thanking you if you have any suggestion please give me prabhatmishra21@rediffmail.com
0 Answers Corporation Bank, State Bank Of India SBI,