|
|
|
| Как во всех браузерах можно определить событие мишки, пример
if(event.button == 1)
{
...
}
|
данное событие только в ИЕ определяется :( | |
|
|
|
|
|
|
|
для: Lelik
(28.08.2006 в 07:15)
| | Документацию можно посмотреть здесь, с рабочими примерами:
http://developer.mozilla.org/en/docs/DOM:event.button
<script type="text/javascript">
function whichButton(e)
{
// Handle different event models
var e = e || window.event;
var btnCode;
if ('object' == typeof e){
btnCode = e.button;
switch (btnCode){
case 0 : alert('Left button clicked');
break;
case 1 : alert('Middle button clicked');
break;
case 2 : alert('Right button clicked');
break;
default : alert('Unexpected code: ' + btnCode);
}
}
}
</script>
<p onclick="whichButton(event);">Click with mouse...</p>
|
| |
|
|
|
|
|
|
|
для: codexomega
(28.08.2006 в 07:22)
| | а где русскоязычную документацию почитать можно? а то я скачал, а половина из примеров в ИЕ выдает значение undefied :( | |
|
|
|
|
|
|
|
для: Lelik
(28.08.2006 в 07:23)
| | за код огромное спасибо :) | |
|
|
|
|
|
|
|
для: Lelik
(28.08.2006 в 07:27)
| | только даннык код в Файрфоксе чего-то не работает
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<META HTTP-EQUIV="Expires" CONTENT="Fri, Jan 01 1900 00:00:00 GMT">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<META http-equiv="Content-Type" content="text/html; charset=windows-1251">
<META http-equiv="content-language" content="en">
<META name="author" content="">
<META HTTP-EQUIV="Reply-to" CONTENT="@.com">
<META name="generator" content="PHPEd 3.1">
<META NAME="description" CONTENT="">
<META name="keywords" content="">
<META NAME="Creation_Date" CONTENT="08/15/2000">
<META name="revisit-after" content="15 days">
<title>вымв</title>
<style type="text/css">
hr {color:#000000; width: 90%; align:center; noshade; size: 1px; margin: 0}
body {width:100%; height:100%; margin:0; padding:0;}
</style>
<script type="text/javascript">
function whichButton(e)
{
// Handle different event models
var e = e || window.event;
var btnCode;
if ('object' == typeof e){
btnCode = e.button;
switch (btnCode){
case 0 : document.getElementById("menu").style.display = "inline";
document.getElementById("menu").style.left = event.clientX;
document.getElementById("menu").style.top = event.clientY;
case 1 : document.getElementById("menu").style.display = "inline";
document.getElementById("menu").style.left = event.clientX;
document.getElementById("menu").style.top = event.clientY;
case 2 : document.getElementById("menu").style.display = "inline";
document.getElementById("menu").style.left = event.clientX;
document.getElementById("menu").style.top = event.clientY;
// Спецом поставил все события, для проверки
}
}
}
</script>
</head>
<body onmousedown="whichButton()">
<h1 id="zag" >Text</h1>
<div id="menu"
style="position:absolute; left:0; top:0; width:100;
height: 150; display: none; background-color:#ACACAC;">
<table border="0" cellpadding="2" cellspacing="0"
width="100" height="100%">
<tr valign="top">
<td>
text 1 <hr>
</td>
</tr>
<tr valign="top">
<td>
text 2 <hr>
</td>
</tr>
<tr valign="top">
<td>
text 3 <hr>
</td>
</tr>
<tr valign="top">
<td>
text 4 <hr>
</td>
</tr>
</table>
</div>
</body>
</html>
|
| |
|
|
|
|
|
|
|
для: Lelik
(28.08.2006 в 07:43)
| | Справочник по JS | |
|
|
|