本文整理汇总了Java中org.w3c.dom.html.HTMLCollection.item方法的典型用法代码示例。如果您正苦于以下问题:Java HTMLCollection.item方法的具体用法?Java HTMLCollection.item怎么用?Java HTMLCollection.item使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.w3c.dom.html.HTMLCollection
的用法示例。
在下文中一共展示了HTMLCollection.item方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setCells
import org.w3c.dom.html.HTMLCollection; //导入方法依赖的package包/类
public void setCells( HTMLCollection cells )
{
Node child;
int i;
child = getFirstChild();
while ( child != null ) {
removeChild( child );
child = child.getNextSibling();
}
i = 0;
child = cells.item( i );
while ( child != null ) {
appendChild ( child );
++i;
child = cells.item( i );
}
}
示例2: get
import org.w3c.dom.html.HTMLCollection; //导入方法依赖的package包/类
public Object get( String propertyName, Scriptable scriptable ) {
HTMLCollection elements = getElements();
for (int i=0; i < elements.getLength(); i++) {
Node node = elements.item( i );
NamedNodeMap attributes = node.getAttributes();
AttrImpl nameAttribute = (AttrImpl) attributes.getNamedItem( "name" );
if (nameAttribute != null && propertyName.equals( nameAttribute.getValue() )) return node;
AttrImpl idAttribute = (AttrImpl) attributes.getNamedItem( "id" );
if (idAttribute != null && propertyName.equals( idAttribute.getValue() )) return node;
}
return super.get( propertyName, scriptable );
}
示例3: reset
import org.w3c.dom.html.HTMLCollection; //导入方法依赖的package包/类
public void reset() {
HTMLCollection elements = getElements();
for (int i = 0; i < elements.getLength(); i++) {
Node node = elements.item(i);
if (node instanceof HTMLControl) ((HTMLControl) node).reset();
}
}
示例4: getPreviousForm
import org.w3c.dom.html.HTMLCollection; //导入方法依赖的package包/类
private HTMLFormElement getPreviousForm( HTMLFormElement nextForm ) {
HTMLCollection forms = getHtmlDocument().getForms();
for (int i = 0; i < forms.getLength(); i++) {
if (nextForm == forms.item( i )) return i == 0 ? null : (HTMLFormElement) forms.item( i-1 );
}
return null;
}
示例5: getValue
import org.w3c.dom.html.HTMLCollection; //导入方法依赖的package包/类
public String getValue() {
HTMLCollection options = getOptions();
for (int i = 0; i < options.getLength(); i++) {
HTMLOptionElement optionElement = ((HTMLOptionElement)options.item(i));
if (optionElement.getSelected()) return optionElement.getValue();
}
return (isMultiSelect() || options.getLength() == 0) ? null : ((HTMLOptionElement)options.item(0)).getValue();
}
示例6: setSelectedIndex
import org.w3c.dom.html.HTMLCollection; //导入方法依赖的package包/类
public void setSelectedIndex( int selectedIndex ) {
HTMLCollection options = getOptions();
for (int i = 0; i < options.getLength(); i++) {
HTMLOptionElementImpl optionElement = (HTMLOptionElementImpl) options.item(i);
optionElement.setSelected( i == selectedIndex );
}
}
示例7: getIndexOf
import org.w3c.dom.html.HTMLCollection; //导入方法依赖的package包/类
int getIndexOf( HTMLOptionElementImpl option ) {
HTMLCollection options = getOptions();
for (int i = 0; i < options.getLength(); i++) {
if (options.item(i) == option) return i;
}
throw new IllegalStateException( "option is not part of this select" );
}
示例8: reset
import org.w3c.dom.html.HTMLCollection; //导入方法依赖的package包/类
public void reset() {
HTMLCollection options = getOptions();
for (int i = 0; i < options.getLength(); i++) {
HTMLControl optionElement = (HTMLControl) options.item(i);
optionElement.reset();
}
}
示例9: setChecked
import org.w3c.dom.html.HTMLCollection; //导入方法依赖的package包/类
public void setChecked( boolean checked ) {
if (checked) {
HTMLCollection elements = getForm().getElements();
for (int i = 0; i < elements.getLength(); i++) {
Node node = elements.item(i);
if (!(node instanceof HTMLInputElementImpl)) continue;
HTMLInputElementImpl input = (HTMLInputElementImpl) node;
if (getName().equals( input.getName() ) && input.getType().equalsIgnoreCase( "radio" )) input.setState( false );
}
}
setState( checked );
}
示例10: getLastFormInDocument
import org.w3c.dom.html.HTMLCollection; //导入方法依赖的package包/类
private HTMLFormElement getLastFormInDocument() {
HTMLCollection forms = getHtmlDocument().getForms();
return forms.getLength() == 0 ? null : (HTMLFormElement) forms.item( forms.getLength()-1 );
}