Изменить действия Enter, Up и Down Arrow Key для использования нескольких радиогрупп с использованием JavaScript/jQueryHtml

Программисты Html
Ответить
Anonymous
 Изменить действия Enter, Up и Down Arrow Key для использования нескольких радиогрупп с использованием JavaScript/jQuery

Сообщение Anonymous »

Я сделал автономный инструмент поддержки принятия решений на одной HTML -странице. Затем показывает соответствующий скрытый Div, либо с большим количеством вопросов - или заканчивается советом. /p>
Сочетания клавиш по умолчанию почти неизвестны моей аудитории. Поэтому я не чувствую, что вина изменяет действия клавиатуры. < /P>
Q1. Как я могу повторно задать ключи со стрелками вверх и вниз, чтобы перейти к следующей/предыдущей радио -группе соответственно - с фокусом (т.е. имическим вкладками и вкладками Shift+?
Q2. Как я могу повторно задать ключ Enter, чтобы выбрать текущую радиопроизводство и двигаться дальше - с фокусом (то есть имитирующим пространство)? Я не отправляю форму, поэтому у меня нет другого использования для клавиши Enter. < /P>
Мой неполный обработчик клавиатуры включен ниже. Есть маркеры Todo, где мне нужна помощь. < /P>





Dislocation of Artificial Hip Joint






window.addEventListener('keydown', function (e) {

// Process e object
var key = e.which
if (e.ctrlKey) { key = "ctrl"+key; }
if (e.altKey) { key = "alt"+key; }
if (e.shiftKey) { key = "shift"+key; }

// ESC - a test
if (key == "27") {
// window.close();
return;
}

// Ctrl+C
if (key == "ctrl67") {
// Preserve default
return;
}

// Ctrl+F
if (key == "ctrl70") {
// Preserve default
return;
}

// Radio Button Shortcuts

// Space
if (key == "32") {
// Preserve default
return;
}

// TAB
if (key == "9") {
// Preserve default
return;
}

// Shift+TAB
if (key == "shift9") {
// Preserve default
return;
}

// LeftArrow
if (key == "37") {
// Preserve default
return;
}

// RightArrow
if (key == "39") {
// Preserve default
return;
}

// Enter - if radio button send space
if (key == "13") {
if($("input[type=radio]").is(':focus')){
// Dissable default
e.preventDefault();
// Simulate Space TODO:
} else {
// Preserve default
return;
}
}

// DownArrow - if radio button send TAB
if (key == "40") {
if($("input[type=radio]").is(':focus')){
// Dissable default
e.preventDefault();
// Simulate TAB to move to next radio group TODO:

} else {
// Preserve default
return;
}
}

// UpArrow - if radio button send Shift+TAB
if (key == "38") {
if($("input[type=radio]").is(':focus')){
// Dissable default
e.preventDefault();
// Simulate Shift+TAB to move to prev radio group TODO:

} else {
// Preserve default
return;
}
}

// Dissable fall-through and all remaining keyboard shortcuts
e.preventDefault();
});



body {
margin: 20;
}
.Q {
margin: 10;
}
input[type='radio']{
transform: scale(2);
margin:10px;
margin-bottom: 15px;
}




Hip Replacement Dislocation

Introduction

These questions will help you assess, document and treat patients with dislocations of their total hip replacements.

Unfortunately patients with unstable hips may present several time in ED, before remedial surgery is undertaken.

Questions

Does your patient have a total hip replacement or hip resurfacing?

Yes
No


function Q0() {
// Hide future questions
$('.Q').slice(0+1).hide();
// Clear future question responses
$('.Y').slice(0+1).prop('checked', false);
$('.N').slice(0+1).prop('checked', false);
// Jump to selected question
if ($('#Q0y').is(':checked')) {
$("#Q1").css("display","block");
$("#Q1y").trigger('focus');
} else {
$("#Q101").css("display","block");
}
}


Do x-rays show the ball outside the socket?

NB. After some years of wear the ball is allowed to be eccentric in the socket.

Yes
No


function Q1() {
$('.Q').slice(1+1).hide();
$('.Y').slice(1+1).prop('checked', false);
$('.N').slice(1+1).prop('checked', false);
if ($('#Q1y').is(':checked')) {
$("#Q2").css("display","block");
$("#Q2y").trigger('focus');
} else {
$("#Q102").css("display","block");
}
}


Is there an open wound, loss of innervation or loss of blood supply!

Yes
No


function Q2() {
$('.Q').slice(2+1).hide();
$('.Y').slice(2+1).prop('checked', false);
$('.N').slice(2+1).prop('checked', false);
if ($('#Q2y').is(':checked')) {
$("#Q103").css("display","block");
} else {
$("#Q3").css("display","block");
$("#Q3y").trigger('focus');
}
}


Typically the whole leg is rotated with a hip dislocation.

Which way is the leg rotated - toes pointing?

Inward
Outward


function Q3() {
$('.Q').slice(3+1).hide();
$('.Y').slice(3+1).prop('checked', false);
$('.N').slice(3+1).prop('checked', false);
if ($('#Q3y').is(':checked')) {
$("#Q4").css("display","block");
} else {
$("#Q5").css("display","block");
}
}


Advice

This is a posterior dislocation of the artificial hip.

Please document you findings:
  • Radiologically proven dislocation
  • Posterior direction
  • Number of previous dislocations
  • No fractures or complex implants
  • No loss of innervation
  • No loss of blood supply
Assuming a suitable patient with no other injuries, this should be reduced by the ED staff in line with locally agreed procedure: For a very unstable hip, splinting the knee will inhibit hip flexion, and may reduce the risk of recurrent posterior dislocation.

Advice

This is an anterior dislocation of the artificial hip.

Please document you findings:
  • Radiologically proven dislocation
  • Anterior direction
  • Number of previous dislocations
  • No fractures or complex implants
  • No loss of innervation
  • No loss of blood supply
Assuming a suitable patient with no other injuries, this should be reduced by the ED staff in line with locally agreed procedure: Splinting the knee, will not reduce the risk of recurrent anterior dislocation.

End of help
These questions are only valid for dislocation of total hip replacements.

Dislocation of a native hip or a hemiarthroplasty, have their own pages.

End of help
If the ball is inside to socket, then the hip is not dislocated.

Look at the x-rays carefully for other causes of sudden hip pain and leg shortening:
  • Periprosthetic fracture of the femur
  • Periprosthetic fracture of the acetabulum
  • Fracture of the stem
  • Dissassembly of the liner in uncemented cups
If you can't make a diagnosis, call the orthopaedic team for help.

End of help
Complicated artificial hip dislocations are uncommon - you will need help.

Before calling the orthopaedic team:
  • For open wounds, please immediately give intravenous broad spectrum antibiotics and tetanus cover
  • For patients with loss of innervation, please document MRC power grading and map loss of sensation
  • For patients with loss of blood supply, please check with doppler for pulses
Now call the orthopaedic team for help.


$("#Q0y").focus();



< /code>
< /div>
< /div>
< /p>
Любая справка оценена. < /p>
С уважением Гэвин Холт


Подробнее здесь: https://stackoverflow.com/questions/794 ... oups-using
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Html»