我試圖找到解決方法,從SharePoint 2007網站上的公告摘要視圖中刪除「by」行。出於各種原因,我在網上找到的東西似乎都行不通 - 所以我想採取另一條路線,提供一些有才華的人才會有所幫助。有誰知道如何使jQuery的工作有些神奇,所以HTML的第一塊可以最終呈現爲第二塊HTML?jQuery可以刪除這段文字嗎?
塊1:
<a onfocus="OnLink(this)" href="/Lists/Our%20Announcements/DispForm.aspx?ID=36" ONCLICK="GoToLink(this);return false;" target="_self">Title of Annoucement </a><IMG SRC="/_layouts/1033/images/new.gif" alt="New"> </span><br>by <nobr><span><A ONCLICK="GoToLink(this);return false;" HREF="/_layouts/userdisp.aspx?ID=2258">Lastname, FirstName I.</A><img border="0" height="1" width="3" src="/_layouts/images/blank.gif" alt="" /><a href="javascript:" onclick="IMNImageOnClick();return false;" class="ms-imnlink"><img title="" alt="No presence information" name="imnmark" border="0" valign="middle" height="12" width="12" src="/_layouts/images/blank.gif" sip="[email protected]" id="imn0,type=smtp" ></a></span></nobr></td><td width=20% align="right" nowrap class="ms-vb"> 4/15/2013 12:51 PM</td></tr><tr><td colspan=2 class="ms-vb"> <div id="{291345DC-BEAE-47B6-8F53-41C07838090C}36"><div class=ExternalClass5BF6EE28A88D436CAC2FE553E7F2CED7><div>
塊2:
<a onfocus="OnLink(this)" href="/Lists/Our%20Announcements/DispForm.aspx?ID=36" ONCLICK="GoToLink(this);return false;" target="_self">Title of Annoucement </a><IMG SRC="/_layouts/1033/images/new.gif" alt="New"> </span></td><td width=20% align="right" nowrap class="ms-vb"> 4/15/2013 12:51 PM</td></tr><tr><td colspan=2 class="ms-vb"> <div id="{291345DC-BEAE-47B6-8F53-41C07838090C}36"><div class=ExternalClass5BF6EE28A88D436CAC2FE553E7F2CED7><div>
這是我需要的東西已經刪除:
<br>by <nobr><span><A ONCLICK="GoToLink(this);return false;" HREF="/_layouts/userdisp.aspx?ID=2258">Lastname, FirstName I.</A><img border="0" height="1" width="3" src="/_layouts/images/blank.gif" alt="" /><a href="javascript:" onclick="IMNImageOnClick();return false;" class="ms-imnlink"><img title="" alt="No presence information" name="imnmark" border="0" valign="middle" height="12" width="12" src="/_layouts/images/blank.gif" sip="[email protected]" id="imn0,type=smtp" ></a></span></nobr>
---------- ------------------更新以獲得更好的格式化---------------------------- --- 真的沒有什麼,我可以看到哪些jQuery的CA ñ選擇。此外,這是來自SharePoint,所以我不能將任何id或div添加到生成的代碼。
塊1:
<TR>
<TD width=80% class="ms-vb" style="padding-bottom: 3px">
<span class="ms-announcementtitle"><a onfocus="OnLink(this)" href="/Lists/Our%20Announcements/DispForm.aspx?ID=36" ONCLICK="GoToLink(this);return false;" target="_self">Title of Annoucement </a><IMG SRC="/_layouts/1033/images/new.gif" alt="New"> </span>
<br>by
<nobr>
<span><A ONCLICK="GoToLink(this);return false;" HREF="/_layouts/userdisp.aspx?ID=2258">Lastname, FirstName I.</A><img border="0" height="1" width="3" src="/_layouts/images/blank.gif" alt="" /><a href="javascript:" onclick="IMNImageOnClick();return false;" class="ms-imnlink"><img title="" alt="No presence information" name="imnmark" border="0" valign="middle" height="12" width="12" src="/_layouts/images/blank.gif" sip="[email protected]" id="imn0,type=smtp" ></a></span>
</nobr>
</td>
<td width=20% align="right" nowrap class="ms-vb"> 4/15/2013 12:51 PM</td>
</tr>
<tr>
<td colspan=2 class="ms-vb">
<div id="{291345DC-BEAE-47B6-8F53-41C07838090C}36">
<div class=ExternalClass5BF6EE28A88D436CAC2FE553E7F2CED7>
<div>
<div>
<p style="line-height:normal;margin:0in 0in 0pt;vertical-align:top" class=MsoNormal>
<b>
<span style="font-family:'Arial','sans-serif';color:black;font-size:9pt">
<em>A message from Firstname Lastname</em>
</span>
</b>
</p>
<p style="line-height:normal;margin:0in 0in 0pt;vertical-align:top" class=MsoNormal>
<span style="font-family:'Arial','sans-serif';color:black;font-size:9pt"></span>
</p>
<p style="line-height:normal;margin:0in 0in 0pt;vertical-align:top" class=MsoNormal>
<span style="font-family:'Arial','sans-serif';color:black;font-size:9pt">Here is the message </span>
</p>
<p style="line-height:normal;margin:0in 0in 0pt;vertical-align:top" class=MsoNormal>
<span style="font-family:'Arial','sans-serif';color:black;font-size:9pt"></span>
</p>
<p style="line-height:normal;margin:0in 0in 0pt;vertical-align:top" class=MsoNormal>
<span style="font-family:'Arial','sans-serif';color:black;font-size:9pt">To...
</div>
</TD>
</TR>
<TR>
<TD>
<font size=1> </font>
</TD>
</TR>
塊2:
<TR>
<TD width=80% class="ms-vb" style="padding-bottom: 3px">
<span class="ms-announcementtitle"><a onfocus="OnLink(this)" href="/Lists/Our%20Announcements/DispForm.aspx?ID=36" ONCLICK="GoToLink(this);return false;" target="_self">Title of Annoucement </a><IMG SRC="/_layouts/1033/images/new.gif" alt="New"> </span>
</td>
<td width=20% align="right" nowrap class="ms-vb"> 4/15/2013 12:51 PM</td>
</tr>
<tr>
<td colspan=2 class="ms-vb">
<div id="{291345DC-BEAE-47B6-8F53-41C07838090C}36">
<div class=ExternalClass5BF6EE28A88D436CAC2FE553E7F2CED7>
<div>
<div>
<p style="line-height:normal;margin:0in 0in 0pt;vertical-align:top" class=MsoNormal>
<b>
<span style="font-family:'Arial','sans-serif';color:black;font-size:9pt">
<em>A message from Firstname Lastname</em>
</span>
</b>
</p>
<p style="line-height:normal;margin:0in 0in 0pt;vertical-align:top" class=MsoNormal>
<span style="font-family:'Arial','sans-serif';color:black;font-size:9pt"></span>
</p>
<p style="line-height:normal;margin:0in 0in 0pt;vertical-align:top" class=MsoNormal>
<span style="font-family:'Arial','sans-serif';color:black;font-size:9pt">Here is the message </span>
</p>
<p style="line-height:normal;margin:0in 0in 0pt;vertical-align:top" class=MsoNormal>
<span style="font-family:'Arial','sans-serif';color:black;font-size:9pt"></span>
</p>
<p style="line-height:normal;margin:0in 0in 0pt;vertical-align:top" class=MsoNormal>
<span style="font-family:'Arial','sans-serif';color:black;font-size:9pt">To...
</div>
</TD>
</TR>
<TR>
<TD>
<font size=1> </font>
</TD>
</TR>
,這樣很容易看你應該格式化代碼! –
是否有任何帶有類或標識符的周邊元素可以讓您識別正確的元素? – jfriend00
我已經更新了我的答案。如果在這種情況下單詞'by'總是在'td'內,那麼你可以用這個單詞搜索'td's',並且只替換那些或者你可以在整個身體上進行替換。取決於你的情況。 – lucuma