style="filter: alpha(opacity=50); opacity: 0.5;"
Dzień: 2009-02-25
25 lut 2009
Współrzędne myszki, pozycja kursora myszki Javascript
<html>
<head>
<script type="text/javascript">
var IE = document.all ? true : false;
if (!IE) document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = myMouseXY;
var pX = 0;
var pY = 0;
function myMouseXY(e) {
if (IE) {
pX = event.clientX + document.body.scrollLeft;
pY = event.clientY + document.body.scrollTop;
} else {
pX = e.pageX;
pY = e.pageY;
}
if (pX < 0) pX = 0;
if (pY < 0) pY = 0;
document.getElementById("ws").value = pX + ',' + pY;
document.getElementById("dymek").style.left = pX;
document.getElementById("dymek").style.top = pY;
return true;
}
</script>
</head>
<body>
<div id="dymek" style="position: absolute;">
<input type="text" id="ws">
</div>
</body>
</html>
25 lut 2009
Zaokrąglanie liczby w JS
alert(n_height);
---------------------------
Windows Internet Explorer
---------------------------
811.267175572519
---------------------------
OK
---------------------------
n=(Math.ceil(n_height*100))/100;
alert(n);
---------------------------
Windows Internet Explorer
---------------------------
811.27
---------------------------
OK
---------------------------
n_height = parseInt(n_height);
---------------------------
Windows Internet Explorer
---------------------------
811
---------------------------
OK
---------------------------