647Chapter 21The Form and Related ObjectsAbout these objectsThe (Sex offenders web site)
Wednesday, October 31st, 2007647Chapter 21The Form and Related ObjectsAbout these objectsThe fieldsetand legendelements go hand in hand to provide some visual context to aseries of form controls within a form. Browsers that implement the fieldsetelement draw arectangle around the document space occupied by the form controls nested inside thefieldsetelement (although MacIE5 drops the space into a debossed area on the page anice effect). The rectangle renders the full width of the body, unless its width is controlled byappropriate stylesheet properties (for example, width). To that rectangle is added a textlabel that is assigned via the legendelement nested inside the fieldsetelement. (ForMacIE5, the legend text is rendered just inside the debossed space.) None of this HTML- controlled grouping is necessary if you design a page layout that already provides graphicalelements to group the form controls together. Nesting the elements properly is essential to obtaining the desired browser rendering. A typi- cal HTML sequence looks like the following:
You can have more than one fieldsetelement inside a form. Each set has a rectangle drawnaround it. This can help organize a long form into more easily digestible blocks of controls forusers yet the single form retains its integrity for submission to the server. A fieldsetelement acts like any HTML container with respect to stylesheets and the inheri- tance thereof. For example, if you set the colorstyle property of a fieldsetelement, thecolor affects the text of elements nested within; however, the color of the border drawn bythe browser is unaffected. Assigning a color to the fieldsetstyle s border-colorpropertycolors just the border and not the textual content of nested elements. Note that the content of the legendelement can be any HTML. Alternatively, you can assign adistinctive stylesheet rule to the legendelement. If your scripts need to modify the text ofthe legend, you can accomplish this with the innerText(IE4+), innerHTML(IE4+, NN6+, Moz1+, Safari1+), or nodeValue(IE5+, W3C) properties of HTML element objects. Only two element-specific properties are assigned to this object pair. The first is the alignproperty of the legendobject. This property matches the capabilities of the alignattributefor the element as specified in the HTML 4.0 recommendation (albeit the property is depre- cated in favor of stylesheet rules). MacIE5+ and WinIE5.5+ enable you to adjust this propertyon the fly (generally between your choices of right and left ) to alter the location of the leg- end at the top of the fieldset rectangle. Because these elements are children of a formelement, it makes sense that the DOM Level 2specification supplies the read-only formproperty to both of these objects. That propertyreturns a reference to the formelement object that encloses either element. The formprop- erty for the fieldsetand legendobjects is implemented in WinIE6, MacIE5, and W3Cbrowsers. fieldset
We recommend cheap and reliable webhost to host and run your web applications: Coldfusion Web Hosting services.