HTMLOptionsCollection

HTMLOptionsCollection

ภาพรวม

HTMLOptionsCollection เป็นคลาสใน Aspose.Html FOSS สำหรับ Python.

คอลเลกชันแบบสดขององค์ประกอบ <option> สำหรับ <select>.

คลาสนี้ให้ 6 เมธอดสำหรับทำงานกับออปเจกต์ HTMLOptionsCollection ในโปรแกรม Python. เมธอดที่มีรวมถึง: __init__, add, item, namedItem, named_item, remove. สมาชิกสาธารณะทั้งหมดสามารถเข้าถึงได้โดยแอปพลิเคชัน Python ใดก็ได้หลังจากติดตั้งแพคเกจ Aspose.Html FOSS สำหรับ Python. คุณสมบัติ: length, selectedIndex, selected_index.

คุณสมบัติ

ชื่อประเภทการเข้าถึงคำอธิบาย
lengthintอ่านจำนวนขององค์ประกอบ <option> ในคอลเลกชัน.
selected_indexintอ่านดัชนีเริ่มต้นจาก 0 ของตัวเลือกแรกที่เลือก, หรือ -1.
selectedIndexintอ่านนามแฝงของ :attr:selected_index (รูปแบบตัวอักษร Web IDL).

วิธีการ

ลายเซ็นคำอธิบาย
__init__(select_element: Node)Calls init(select_element) บนอินสแตนซ์ HTMLOptionsCollection นี้.
item(index: int) → `NodeNone`
named_item(name: str) → `NodeNone`
namedItem(name: str) → `NodeNone`
`add(element: Node, before: Nodeint
remove(index: int)ลบตัวเลือกที่ index ถ้ามี.

ดูเพิ่มเติม

 ภาษาไทย