costringere qualcuno a fare clic su una chiave con codice javascript. Per esempio:
$("#gameCanvas").mousedown(function(ev){
if(ev.which == 3)
{
this blank is for that want.
} });
Voglio forzare gli utenti a fare clic sul pulsante dello spazio quando hanno fatto clic con il tasto destro del mouse.
risposte:
0 per risposta № 1Potresti provare una soluzione come la seguente. Questo il collegamento al jQuery api doc.
$("#gameCanvas").mousedown(function(ev){
if(ev.which == 3)
{
// Create a new jQuery.Event object with specified event properties.
var e = jQuery.Event( "keydown", { keyCode: 32 } );
// trigger an artificial keydown event with keyCode 32
jQuery( "body" ).trigger( e );
} });