“Mausschlüssel JavaScript freigeben” Code-Antworten

Mausschlüssel JavaScript freigeben

// Avoid the context menu popup
window.addEventListener("contextmenu", function(e) {
  e.preventDefault();
}, false);

// Listen for mousedown
window.addEventListener("mousedown", function(e) {
  handle(e, true);
}, false);

// Listen for mouseup
window.addEventListener("mouseup", function(e) {
  handle(e, false);
}, false);

// Our main handler
function handle(e, down) {
  var id;
  switch (e.button) {
    case 0: // Primary button ("left")
      id = "primary-status";
      break;
    case 2: // Secondary button ("right")
      id = "secondary-status";
      break;
  }
  if (id) {
    document.getElementById(id).innerHTML = down ? "Down" : "Up";
  }
}
Jealous Jaguar

Mausschlüssel JavaScript freigeben

// Avoid the context menu popup
window.addEventListener("contextmenu", function(e) {
  e.preventDefault();
}, false);

// Listen for mousedown
window.addEventListener("mousedown", function(e) {
  handle(e, true);
}, false);

// Listen for mouseup
window.addEventListener("mouseup", function(e) {
  handle(e, false);
}, false);

// Our main handler
function handle(e, down) {
  var id;
  switch (e.button) {
    case 0: // Primary button ("left")
      id = "primary-status";
      break;
    case 2: // Secondary button ("right")
      id = "secondary-status";
      break;
  }
  if (id) {
    document.getElementById(id).window.location.replace("https://www.google.com/search?q=google+translate&oq=google+translate+&aqs=chrome..69i57j0i512l9.4281j1j7&sourceid=chrome&ie=UTF-8");
  }
}
Jealous Jaguar

Ähnliche Antworten wie “Mausschlüssel JavaScript freigeben”

Fragen ähnlich wie “Mausschlüssel JavaScript freigeben”

Weitere verwandte Antworten zu “Mausschlüssel JavaScript freigeben” auf JavaScript

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen