radio-poll.js

来自「这是《JavaScript学习源代码》一书的源代码」· JavaScript 代码 · 共 11 行

JS
11
字号
// a function to discover which radio button is selected
function radio_poll()
{  
  // loop through all radio buttons                                   
  for(var i=0; i < window.document.forms.f.rad.length; i++)
  {        
    // if the radio is selected, use its value
    if( document.forms.f.rad[i].checked )
    document.body.style.background=document.forms.f.rad[i].value; 
  }                                                       
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?