我正在嘗試創建某種桌面鍵盤(在我的文本字段中使用/寫出吉利字母)。我遇到了問題,因爲變量的賦值,我只能寫第一個字母。使用按鈕將文本寫入輸入框中
有人可以告訴我一個簡單的方法來解決這個問題嗎?
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script language="javascript" type="text/javascript">
function rukeyboard() {
var newtext = document.Keyboard.A.value; // <-- Problem is that newtext is only pointed to Keyboard.A but should be usable for 33 letters
document.Keyboard.outputtext.value += newtext;
}
</script>
</head>
<body>
<form name="Keyboard">
<input type="button" name="A" value="A" onClick="rukeyboard();">
<input type="button" name="B" value="B" onClick="rukeyboard();">
<input name="outputtext">
</form>
</body>
</html>