selected.js
来自「这是《JavaScript学习源代码》一书的源代码」· JavaScript 代码 · 共 12 行
JS
12 行
// a function to get the selected item in a list
function get_selected()
{
// a variable to store the selected index number
var pick = window.document.forms.f.city.selectedIndex;
// assign the associated value of the selected element
// to a text field with the id of "txt1"
window.document.forms.f.txt1.value =
window.document.forms.f.city.options[pick].value;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?