📅  最后修改于: 2022-03-11 15:01:26.982000             🧑  作者: Mango
document.addEventListener("keydown", function(event)
{
if (event.key == "c")
{
console.log("C Pressed");
document.getElementById("btnConvert").click();
}
var convertButton = document.getElementById("btnConvert");
if (event.key == "Backspace")
{
console.log("Backspace Pressed");
var textboxContent = document.getElementById("txtFahrenheit").value;
if (textboxContent.value == "" || textboxContent.value == "-")
{
convertButton.disabled = true;
}
}
})
/*HTML:
*/