Web hosting faq - 591Chapter 26 .Select, Option, and FileUpload Objects of
Sunday, September 30th, 2007591Chapter 26 .Select, Option, and FileUpload Objects of the entire SELECT object. To get the displayed text of the selected option, however, you must zero in further to extract the text property of a single option among all options defined for the object. When you define a SELECT object within a form, the construction of the tag pair is easy to inadvertently mess up. First, most attributes that define the entire object such as NAME, SIZE, and event handlers are attributes of the opening tag are additional tags for each option to be displayed in the list. The following object definition creates a selection pop-up list containing three color choices:
The indented formatting of the tags in the HTML document is not critical. I indent the lines of options merely for the sake of readability. By default, a SELECT element is rendered as a pop-up list. To make it appear as a scrolled list, assign an integer value greater than 1 to the SIZE attribute to specify how many options should be visible in the list without scrolling how tall the list s box should be, measured in lines. Because scrollbars in GUI environments tend to require a fair amount of space to display a minimum set of clickable areas (including sliding thumbs ), you should set list-box style sizes to no less than 4. If that makes the list box too tall for your page design, consider using a pop-up menu instead. Significant differences exist in the way each GUI platform presents pop-up menus. Because each browser sometimes relies on the operating system to display its native pop-up menu style (and sometimes the browser designers go their own way), considerable differences exist among the OS and browser platforms in the size of a given pop-up menu. What fits nicely within a standard window width of one OS may not fit in the window of another OS in a different browser. In other words, you cannot rely on any SELECT object having a precise dimension on a page (in case you re trying to align a SELECT object with an image). In list-box form, you can set a SELECT object to accept multiple, noncontiguous selections. Users typically accomplish such selections by holding down a modifier key (the Shift, Ctrl, or key, depending on the operating system) while clicking additional options. To switch on this capability for a SELECT object, include the MULTIPLE attribute constant in the definition. For each entry in a list, your