HTMLOptionsCollection
HTMLOptionsCollection
نمای کلی
HTMLOptionsCollection یک کلاس در Aspose.Html FOSS برای Python است.
مجموعه زندهای از عناصر <option> برای یک <select>.
این کلاس 6 متد برای کار با اشیای HTMLOptionsCollection در برنامههای Python ارائه میدهد. متدهای موجود عبارتند از: __init__, add, item, namedItem, named_item, remove. تمام اعضای عمومی پس از نصب بسته Aspose.Html FOSS برای Python برای هر برنامهٔ Python قابل دسترسی هستند. ویژگیها: length, selectedIndex, selected_index.
خواص
| نام | نوع | دسترسی | توضیح |
|---|---|---|---|
length | int | خواندن | تعداد عناصر <option> در مجموعه. |
selected_index | int | خواندن | اندیس صفرپایهٔ اولین گزینهٔ انتخابشده، یا -1. |
selectedIndex | int | خواندن | نام مستعار برای :attr:selected_index (قالبگذاری Web IDL). |
روش ها
| امضا | توضیح |
|---|---|
__init__(select_element: Node) | Calls init(select_element) در این نمونه HTMLOptionsCollection. |
item(index: int) → `Node | None` |
named_item(name: str) → `Node | None` |
namedItem(name: str) → `Node | None` |
| `add(element: Node, before: Node | int |
remove(index: int) | حذف گزینه در index اگر موجود باشد. |