checkbox-poll.js
来自「这是《JavaScript学习源代码》一书的源代码」· JavaScript 代码 · 共 16 行
JS
16 行
// a function to discover which checkboxes are selected
function checkbox_poll()
{
// create a string for the results
var str = "Color choice is ";
// loop through the checkboxes
for( var i=1; i<4; i++ )
{
// if the checkbox is checked, add its value
if( eval("window.document.forms.f.chk"+i+".checked") )
str += eval("window.document.forms.f.chk"+i+".value+' '");
}
// display the results
alert( str );
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?