getElementById()方法取值
举例子:
javascript:
1 var time = document.getElementById('jidu').value; //指定时间 2 var taskclass = document.getElementById('zu').innerHTML; //组
html是:
<p >请注意,<span id="zu">新媒体</span><span id="riqi">当天</span>有人旷工</p> <select name="jidu" id="jidu"> <option value="day" >当天</option> <option value="week" >本周</option> <option value="month" >本月</option> <option value="year" >本年</option> <option value="all" >全部</option> </select>
id = zu ,取值是两个标签之间的值,用 innerHTML ;
id = jidu ,是标签内属性值,用 value