I upload the snaps of the codes to Flickr.com.
Here is the html part: http://www.flickr.com/photos/59919989@N08/5470586866/
Here is the JavaScript part: http://开发者_如何学运维www.flickr.com/photos/59919989@N08/5470587034/
Could someone tell me what is the meaning of the circled part? What does it do? Thank you very much.
it gets the element with the id named "months" and in your html it shows that it is the select tag. it then sets the selected item by default using selectedIndex. 0 means the first item in your options list which is "Month"
also next time, please put your code in http://jsfiddle.net
Given that this is straight out of JavaScript & Ajax for the Web: Visual QuickStart Guide, 7th edition1, what in particular are you having trouble with in the (line-by-line) explanation on pages 164-166?
1 Co-written by me, btw.
精彩评论