我在页面上有一组连接的 Web 部件。基本上这些都是开箱即用的 webparts 并且是连接的。提供者和消费者在用户名字段 (donmain\userName) 上连接。因此,从提供者 Web 部件中选择一个值会更新所有消费者 Web 部件数据。
现在我的问题是,我想从 webpart 中获取所选项目,所选项目有一个“img”标签,其“alt”文本为“已选择”,因此基于此我想获取下一个元素的所选文本.
这是我的标记,我希望从标记中返回值“domain\test.officer”,因为它是所选项目。
<TABLE id={2E5002B0-EDC3-4541-A0ED-2A81797B459C}-{F1162455-D63E-481D-B13C-C1A4A59E5A34} class=ms-listviewtable border=0 cellSpacing=0 summary="Trainee " cellPadding=1 width="100%" xmlns:o="urn:schemas-microsoft-com:office:office" o:WebQuerySourceHref="http://test.app.domain.net/test/_vti_bin/owssvr.dll?CS=65001&XMLDATA=1&RowLimit=0&View={F1162455-D63E-481D-B13C-C1A4A59E5A34}" handleDeleteInit="true"><TBODY>
<TR class="ms-viewheadertr ms-vhltr" vAlign=top>
<TH class=ms-vh-icon scope=col><INPUT class=s4-selectAllCbx title="Select or deselect all items" onclick=ToggleAllItems(event,this,159) value="" type=checkbox></TH>
<TH class=ms-vh2 onmouseover=OnChildColumn(this) scope=col noWrap>
<DIV class=ms-vh-div name="SelectTitle" SortFields="View={f1162455-d63e-481d-b13c-c1a4a59e5a34}&SortField=SelectTitle&SortDir=Asc" ResultType="" FieldType="Computed" DisplayName="Select" CTXNum="159" FilterDisableMessage="" Filterable="FALSE" FilterDisable="" SortDisable="" Sortable="FALSE">Select</DIV></TH>
<TH class=ms-vh-icon onmouseover=OnChildColumn(this) scope=col noWrap>
<DIV class=ms-vh-div name="Attachments" SortFields="View={f1162455-d63e-481d-b13c-c1a4a59e5a34}&SortField=Attachments&SortDir=Asc" ResultType="" FieldType="Attachments" DisplayName="Attachments" CTXNum="159" FilterDisableMessage="" Filterable="" FilterDisable="" SortDisable="" Sortable=""><A id=diidSortAttachments onfocus=OnFocusFilter(this) onclick="javascript:return OnClickFilter(this,event);" href="javascript: " SortingFields="View={f1162455-d63e-481d-b13c-c1a4a59e5a34}&SortField=Attachments&SortDir=Asc"><IMG border=0 src="/_layouts/images/attachhd.gif"><IMG class=ms-hidden border=0 alt="Use SHIFT+ENTER to open the menu (new window)." src="/_layouts/images/blank.gif" width=1 height=1></A><IMG border=0 alt="" src="/_layouts/images/blank.gif"><IMG border=0 alt="" src="/_layouts/images/blank.gif"></DIV>
<DIV class=s4-ctx><SPAN> </SPAN><A onfocus="OnChildColumn(this.parentNode.parentNode); return false;" title="Open Menu" onclick="PopMenuFromChevron(event); return false;" href="javascript:;"></A><SPAN> </SPAN></DIV></TH>
<TH class=ms-vh2 onmouseover=OnChildColumn(this) scope=col noWrap>
<DIV class=ms-vh-div name="LinkTitle" SortFields="View={f1162455-d63e-481d-b13c-c1a4a59e5a34}&SortField=LinkTitle&SortDir=Asc" ResultType="" FieldType="Computed" DisplayName="Title" CTXNum="159" FilterDisableMessage="" Filterable="" FilterDisable="" SortDisable="" Sortable=""><A id=diidSortLinkTitle onfocus=OnFocusFilter(this) onclick="javascript:return OnClickFilter(this,event);" href="javascript: " SortingFields="View={f1162455-d63e-481d-b13c-c1a4a59e5a34}&SortField=LinkTitle&SortDir=Asc">Title<IMG class=ms-hidden border=0 alt="Use SHIFT+ENTER to open the menu (new window)." src="/_layouts/images/blank.gif" width=1 height=1></A><IMG border=0 alt="" src="/_layouts/images/blank.gif"><IMG border=0 alt="" src="/_layouts/images/blank.gif"></DIV>
<DIV class=s4-ctx><SPAN> </SPAN><A onfocus="OnChildColumn(this.parentNode.parentNode); return false;" title="Open Menu" onclick="PopMenuFromChevron(event); return false;" href="javascript:;"></A><SPAN> </SPAN></DIV></TH></TR>
<TR class=ms-itmhover iid="159,9,0" setEdgeBorder="true">
<TD class="ms-vb-itmcbx ms-vb-firstCell"><INPUT class=s4-itm-cbx title="domain\test.user1 " value="" type=checkbox _setup="true"></TD>
<TD class=ms-vb2><IMG style="CURSOR: hand" border=0 alt=Selected align=absMiddle src="/_layouts/images/rbsel.gif"></TD>
<TD class=ms-vb2></TD>
<TD class="ms-vb-title ms-vb-lastCell" onmouseover=OnChildItem(this) height="100%">
<DIV id=9 class="ms-vb itx" onmouseover=OnItem(this) EventType="" Perm="0x7fffffffffffffff" Field="LinkTitle" CTXName="ctx159"><A onfocus=OnLink(this) onclick="EditLink2(this,159);return false;" href="http://test.app.domain.net/test/_layouts/listform.aspx?PageType=4&ListId={2E5002B0-EDC3-4541-A0ED-2A81797B459C}&ID=9&ContentTypeID=0x0100801F054C4E00C243A9A49EC13FF778D7003293EF8DE37E144BAA8A5296D5E6CA8B" target=_self>domain\test.user1</A><IMG class=ms-newgif title=New alt=New src="/_layouts/1033/images/new.gif"></DIV>
<DIV class=s4-ctx onmouseover="OnChildItem(this.parentNode); return false;"><SPAN> </SPAN><A onfocus="OnChildItem(this.parentNode.parentNode); return false;" title="Open Menu" onclick="PopMenuFromChevron(event); return false;" href="javascript:;"></A><SPAN> </SPAN></DIV></TD></TR>
<TR class="ms-alternating ms-itmhover" iid="159,8,0" setEdgeBorder="true">
<TD class="ms-vb-itmcbx ms-vb-firstCell"><INPUT class=s4-itm-cbx title="domain\test.officer " value="" type=checkbox _setup="true"></TD>
<TD class=ms-vb2><A onclick="SelectField('{F1162455-D63E-481D-B13C-C1A4A59E5A34}','8');return false;" href="javascript:SelectField('{F1162455-D63E-481D-B13C-C1A4A59E5A34}','8');return false;" target=_self><IMG style="CURSOR: hand" border=0 alt=Normal align=absMiddle src="/_layouts/images/rbunsel.gif"></A></TD>
<TD class=ms-vb2></TD>
<TD class="ms-vb-title ms-vb-lastCell" onmouseover=OnChildItem(this) height="100%">
<DIV id=8 class="ms-vb itx" onmouseover=OnItem(this) EventType="" Perm="0x7fffffffffffffff" Field="LinkTitle" CTXName="ctx159"><A onfocus=OnLink(this) onclick="EditLink2(this,159);return false;" href="http://test.app.domain.net/test/_layouts/listform.aspx?PageType=4&ListId={2E5002B0-EDC3-4541-A0ED-2A81797B459C}&ID=8&ContentTypeID=0x0100801F054C4E00C243A9A49EC13FF778D7003293EF8DE37E144BAA8A5296D5E6CA8B" target=_self>domain\test.officer</A><IMG class=ms-newgif title=New alt=New src="/_layouts/1033/images/new.gif"></DIV>
<DIV class=s4-ctx onmouseover="OnChildItem(this.parentNode); return false;"><SPAN> </SPAN><A onfocus="OnChildItem(this.parentNode.parentNode); return false;" title="Open Menu" onclick="PopMenuFromChevron(event); return false;" href="javascript:;"></A><SPAN> </SPAN></DIV></TD></TR>
<TR class=ms-itmhover iid="159,5,0" setEdgeBorder="true">
<TD class="ms-vb-itmcbx ms-vb-firstCell"><INPUT class=s4-itm-cbx title="domain\n.test " value="" type=checkbox _setup="true"></TD>
<TD class=ms-vb2><A onclick="SelectField('{F1162455-D63E-481D-B13C-C1A4A59E5A34}','5');return false;" href="javascript:SelectField('{F1162455-D63E-481D-B13C-C1A4A59E5A34}','5');return false;" target=_self><IMG style="CURSOR: hand" border=0 alt=Normal align=absMiddle src="/_layouts/images/rbunsel.gif"></A></TD>
<TD class=ms-vb2></TD>
<TD class="ms-vb-title ms-vb-lastCell" onmouseover=OnChildItem(this) height="100%">
<DIV id=5 class="ms-vb itx" onmouseover=OnItem(this) EventType="" Perm="0x7fffffffffffffff" Field="LinkTitle" CTXName="ctx159"><A onfocus=OnLink(this) onclick="EditLink2(this,159);return false;" href="http://test.app.domain.net/test/_layouts/listform.aspx?PageType=4&ListId={2E5002B0-EDC3-4541-A0ED-2A81797B459C}&ID=5&ContentTypeID=0x0100801F054C4E00C243A9A49EC13FF778D7003293EF8DE37E144BAA8A5296D5E6CA8B" target=_self>domain\n.test</A><IMG class=ms-newgif title=New alt=New src="/_layouts/1033/images/new.gif"></DIV>
<DIV class=s4-ctx onmouseover="OnChildItem(this.parentNode); return false;"><SPAN> </SPAN><A onfocus="OnChildItem(this.parentNode.parentNode); return false;" title="Open Menu" onclick="PopMenuFromChevron(event); return false;" href="javascript:;"></A><SPAN> </SPAN></DIV></TD></TR>
<TR class="ms-alternating ms-itmhover" iid="159,3,0" setEdgeBorder="true">
<TD class="ms-vb-itmcbx ms-vb-firstCell"><INPUT class=s4-itm-cbx title="domain\test1.user1 " value="" type=checkbox _setup="true"></TD>
<TD class=ms-vb2><A onclick="SelectField('{F1162455-D63E-481D-B13C-C1A4A59E5A34}','3');return false;" href="javascript:SelectField('{F1162455-D63E-481D-B13C-C1A4A59E5A34}','3');return false;" target=_self><IMG style="CURSOR: hand" border=0 alt=Normal align=absMiddle src="/_layouts/images/rbunsel.gif"></A></TD>
<TD class=ms-vb2></TD>
<TD class="ms-vb-title ms-vb-lastCell" onmouseover=OnChildItem(this) height="100%">
<DIV id=3 class="ms-vb itx" onmouseover=OnItem(this) EventType="" Perm="0x7fffffffffffffff" Field="LinkTitle" CTXName="ctx159"><A onfocus=OnLink(this) onclick="EditLink2(this,159);return false;" href="http://test.app.domain.net/test/_layouts/listform.aspx?PageType=4&ListId={2E5002B0-EDC3-4541-A0ED-2A81797B459C}&ID=3&ContentTypeID=0x0100801F054C4E00C243A9A49EC13FF778D7003293EF8DE37E144BAA8A5296D5E6CA8B" target=_self>domain\test1.user1</A><IMG class=ms-newgif title=New alt=New src="/_layouts/1033/images/new.gif"></DIV>
<DIV class=s4-ctx onmouseover="OnChildItem(this.parentNode); return false;"><SPAN> </SPAN><A onfocus="OnChildItem(this.parentNode.parentNode); return false;" title="Open Menu" onclick="PopMenuFromChevron(event); return false;" href="javascript:;"></A><SPAN> </SPAN></DIV></TD></TR>
<TR class=ms-itmhover iid="159,2,0" setEdgeBorder="true">
<TD class="ms-vb-itmcbx ms-vb-firstCell"><INPUT class=s4-itm-cbx title="domain\admin.user " value="" type=checkbox _setup="true"></TD>
<TD class=ms-vb2><A onclick="SelectField('{F1162455-D63E-481D-B13C-C1A4A59E5A34}','2');return false;" href="javascript:SelectField('{F1162455-D63E-481D-B13C-C1A4A59E5A34}','2');return false;" target=_self><IMG style="CURSOR: hand" border=0 alt=Normal align=absMiddle src="/_layouts/images/rbunsel.gif"></A></TD>
<TD class=ms-vb2></TD>
<TD class="ms-vb-title ms-vb-lastCell" onmouseover=OnChildItem(this) height="100%">
<DIV id=2 class="ms-vb itx" onmouseover=OnItem(this) EventType="" Perm="0x7fffffffffffffff" Field="LinkTitle" CTXName="ctx159"><A onfocus=OnLink(this) onclick="EditLink2(this,159);return false;" href="http://test.app.domain.net/test/_layouts/listform.aspx?PageType=4&ListId={2E5002B0-EDC3-4541-A0ED-2A81797B459C}&ID=2&ContentTypeID=0x0100801F054C4E00C243A9A49EC13FF778D7003293EF8DE37E144BAA8A5296D5E6CA8B" target=_self>domain\admin.user</A></DIV>
<DIV class=s4-ctx onmouseover="OnChildItem(this.parentNode); return false;"><SPAN> </SPAN><A onfocus="OnChildItem(this.parentNode.parentNode); return false;" title="Open Menu" onclick="PopMenuFromChevron(event); return false;" href="javascript:;"></A><SPAN> </SPAN></DIV></TD></TR>
<TR class="ms-alternating ms-itmhover" iid="159,1,0" setEdgeBorder="true">
<TD class="ms-vb-itmcbx ms-vb-firstCell"><INPUT class=s4-itm-cbx title="domain\portal.user " value="" type=checkbox _setup="true"></TD>
<TD class=ms-vb2><A onclick="SelectField('{F1162455-D63E-481D-B13C-C1A4A59E5A34}','1');return false;" href="javascript:SelectField('{F1162455-D63E-481D-B13C-C1A4A59E5A34}','1');return false;" target=_self><IMG style="CURSOR: hand" border=0 alt=Normal align=absMiddle src="/_layouts/images/rbunsel.gif"></A></TD>
<TD class=ms-vb2></TD>
<TD class="ms-vb-title ms-vb-lastCell" onmouseover=OnChildItem(this) height="100%">
<DIV id=1 class="ms-vb itx" onmouseover=OnItem(this) EventType="" Perm="0x7fffffffffffffff" Field="LinkTitle" CTXName="ctx159"><A onfocus=OnLink(this) onclick="EditLink2(this,159);return false;" href="http://test.app.domain.net/test/_layouts/listform.aspx?PageType=4&ListId={2E5002B0-EDC3-4541-A0ED-2A81797B459C}&ID=1&ContentTypeID=0x0100801F054C4E00C243A9A49EC13FF778D7003293EF8DE37E144BAA8A5296D5E6CA8B" target=_self>domain\portal.user</A></DIV>
<DIV class=s4-ctx onmouseover="OnChildItem(this.parentNode); return false;"><SPAN> </SPAN><A onfocus="OnChildItem(this.parentNode.parentNode); return false;" title="Open Menu" onclick="PopMenuFromChevron(event); return false;" href="javascript:;"></A><SPAN> </SPAN></DIV></TD></TR></TBODY></TABLE>