0

我们创建了以下内容以在我们的网站上查找旗帜,并在我们的网站上显示某些国家/地区的旗帜时显示消息。

我想对此进行调整以在下方显示消息,除非页面上的任何位置显示英镑符号 (£)。我该怎么做?非常感谢

<p id="checkout_notification_text" style="display:none;margin-top:-7px;"><b>As you are viewing prices in a currency other than GBP, prices shown will be converted into GBP by your card processor. This card processor <i>may</i> add a currency conversion fee of up to 2.5%.</b></p>
 <script type="text/javascript">
    var flg =readCookie("currencyflag");
    if (!flg) {
             $("dl.CurrencyList").children().eq(0).find("img").each(function(){
                flg =$(this).attr("src"); 
             });
     }
    if(flg) {
        var flgImgArray = flg.split("/");
        var flgImg = flgImgArray[flgImgArray.length-1]; 

        if(flgImg != 'gb.gif'){
           $('#checkout_notification_text').show();
        }else{
           $('#checkout_notification_text').hide();
        }
    }
</script>  

我现在使用的代码:

<p id="checkout_notification_text" style="display:none;margin-top:-7px;"><b>As you are viewing prices in a currency other than GBP, prices shown will be converted into GBP by your card processor. This card processor <i>may</i> add a currency conversion fee of up to 2.5%.</b></p>
 <script type="text/javascript"> 
if ($("body:contains('£')").length) {
 $('#checkout_notification_text').hide();
} else {
//it is not found
}
 </script>  
4

1 回答 1

3

我认为您仍然想做标记搜索,但如果发现 £ 总是隐藏标记

使用 jQuery

http://jsfiddle.net/a4U5A/3/

if ($("body:contains('£')").length) {
     $('#checkout_notification_text').hide();
} else {
    //it is not found
}
于 2013-09-28T01:35:11.967 回答