8 mar 2009

Funkcja alert wykorzystana do sprawdznia danych

function red_alert() {
var red = 'alert';
var blad = '';

 blad += test_red(table);
 blad += test_alert();
 if(blad!='') {

  blad = "Red Alert: Proszę wypełnić prawidlowo kod:" + blad;
  alert(blad);
  return false;
 }
 updateData(table);
}

Definicja funkcji sprawdzenia kodu red alert.

3 mar 2009

Standardowe nazwy kursorów myszki

Standardowe nazwy kursorów myszki:

auto
crosshair
default
help
move
pointer
text
wait

i mniej standardowe

hand
progress
not-allowed
no-drop
vertical-text
all-scroll
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>