我有以下XML文件:
<Section Id="1" Type="page" Caption="Message Details">
<Containers>
<Form Id="General" Caption="General Details" Source="Request" Layout="Fixed">
<Controls>
<Control Id="MessageType" Caption="Message Type" Source="Param[@Name = 'MessageType']" FieldName="Value" DataType="select" Width="150" CaptionWidth="120" ReadOnly="1" Mandatory="1" DefaultValue="Allert" Action="handleMessageTypeChange()" BreakAfter="0">
<Member Value="SMS" Caption="SMS"/>
<Member Value="EMAIL" Caption="EMAIL"/>
<Member Value="ATOS" Caption="ATOS"/>
<Member Value="SELF SERVICE" Caption="SELF SERVICE"/>
</Control>
<Control Id="Language" Caption="Language" Source="Param[@Name = 'Language']" FieldName="Value" DataType="string" Width="100" CaptionWidth="90" ReadOnly="1" BreakAfter="1"/>
<Control Id="FirstName" Caption="First Name" Source="Param[@Name = 'FirstName']" FieldName="Value" DataType="string" Width="350" CaptionWidth="120" BreakAfter="1" DefaultValue="hello"/>
<Control Id="LastName" Caption="Last Name" Source="Param[@Name = 'LastName']" FieldName="Value" DataType="string" Width="350" CaptionWidth="120" BreakAfter="1"/>
<Control Id="IMTSI" Caption="IMTSI" Source="Param[@Name = 'IMTSI']" FieldName="Value" DataType="string" Width="350" CaptionWidth="120" BreakAfter="1" Mandatory="0"/>
<Control Id="Mobile" Caption="Mobile" Source="Param[@Name = 'Mobile']" FieldName="Value" DataType="string" Width="350" CaptionWidth="120" BreakAfter="1" Mandatory="1"/>
<Control Id="Email" Caption="Email" Source="Param[@Name = 'Email']" FieldName="Value" DataType="string" Width="350" CaptionWidth="120" BreakAfter="1" Mandatory="0"/>
<Control Id="Subject" Caption="Subject" Source="Param[@Name = 'Subject']" FieldName="Value" DataType="string" Width="350" CaptionWidth="120" BreakAfter="1" MaxLen="40" Hidden="1"/>
<Control Id="Content" Caption="Content" Source="Param[@Name = 'Content']" FieldName="Value" DataType="longstring" Width="350" CaptionWidth="120" Height="60" BreakAfter="1" MaxLen="50" Mandatory="1" SeparateBefore="1" SeparateAfter="1"/>
<Control Id="Sender" Caption="Sender" Source="Param[@Name = 'Sender']" FieldName="Value" DataType="string" Width="350" CaptionWidth="120" ReadOnly="1" BreakAfter="1"/>
<Control Id="Priority" Caption="Priority" Source="Param[@Name = 'Priority']" FieldName="Value" DataType="select" Width="350" CaptionWidth="120" BreakAfter="1" DefaultValue="LOW">
<Member Value="LOW" Caption="Low" Glyf="../../GUIGenerator_V2/assets/themes/Images/flag_blue.png"/>
<Member Value="MED" Caption="Medium" Glyf="../../GUIGenerator_V2/assets/themes/Images/flag_yellow.png"/>
<Member Value="HIGH" Caption="High" Glyf="../../GUIGenerator_V2/assets/themes/Images/flag_red.png"/>
</Control>
</Controls>
</Form>
</Containers>
</Section>
</Module>
我正在尝试使用JavaScript获取按钮上的所有“控制”标签(带有标题:主题,内容等),我将如何做到这一点?
答案 0 :(得分:1)
我认为你正在寻找getElementsByTagName。
以下是如何使用它:
var els = document.getElementsByTagName('Control')
for (var i=0, len = els.length; i<len; i++) {
els[i] // You have your element.
}
使用调试器查看每个els[i]
对象中可用的属性。