我製作了一個搜索腳本,用於搜索「萬聖節」和警報。搜索內容並提醒是否
var Item = $('td > a:contains("Hallow")').text()
if(Item) {
alert(Item); }
這個JavaScript正在爲這個網站:
<html><body><div style="Padding:10px;">
<table width="469" cellspacing="0" cellpadding="2" border="0">
<tbody>
<tr valign="top">
<td width="313"> <img width="11" height="10" src="graphics/Default/Miscellaneous/weight.gif" alt="Yük: 3" title="Yük: 3">
<a href="CharacterDetails.asp?action=ViewItemDetails&ItemTypeiD=236&ItemID=100084253&CharacterID=53845">Kovboy çizmeleri</a> </td>
<td width="140" align="right"> </td>
</tr>
<tr valign="top">
<td width="313"> <img width="11" height="10" src="graphics/Default/Miscellaneous/weight.gif" alt="Yük: 5" title="Yük: 5">
<a href="CharacterDetails.asp?action=ViewItemDetails&ItemTypeiD=168&ItemID=68615745&CharacterID=53845">Halloween Canavar Maskesi</a>
</td>
<td width="140" align="right">
</td>
</tr>
</tbody></table>
<table width="469" cellspacing="0" cellpadding="3" border="0">
</table>
<br>
<br>
</div></body></html>
但有時項目是安全的。和HTML是這樣的:
<html><body><div style="Padding:10px;">
<table width="469" cellspacing="0" cellpadding="2" border="0">
<tbody>
<tr valign="top">
<td width="313"> <img width="11" height="10" src="graphics/Default/Miscellaneous/weight.gif" alt="Yük: 3" title="Yük: 3">
<a href="CharacterDetails.asp?action=ViewItemDetails&ItemTypeiD=236&ItemID=100084253&CharacterID=53845">Kovboy çizmeleri</a> </td>
<td width="140" align="right"> </td>
</tr>
<tr valign="top">
<td width="313"> <img width="11" height="10" src="graphics/Default/Miscellaneous/weight.gif" alt="Yük: 5" title="Yük: 5">
<a href="CharacterDetails.asp?action=ViewItemDetails&ItemTypeiD=168&ItemID=68615745&CharacterID=53845">Halloween Canavar Maskesi</a>
</td>
<td width="140" align="right">
Secured
</td>
</tr>
</tbody></table>
<table width="469" cellspacing="0" cellpadding="3" border="0">
</table>
<br>
<br>
</div></body></html>
我不希望我的JavaScript提醒我,如果項目是安全的。
功能必須是這樣的
var Item = $('td > a:contains("Hallow")').text()
var Itemsecured = (A code)
if(Itemsecured) {
}
else {
alert(Item)
}
我需要這個代碼的正確版本。
這很重要:我有兩個項目,其中一個是其他不是。 Javascript必須提醒我。
'
'真的嗎?這是你的標記? – user113716İt是複製錯誤。 –
爲什麼你的代碼在我的屏幕中間?然後你的Javascript沒有縮進?如果你不能讓你的帖子易於閱讀,那麼我不會被困擾,以回答它:( –