如果页面中包含某关键词则显示广告的代码

如果一个页面中包含某一个或多个指定的关键词则显示广告,怎么实现,需要完整的实现方式,谢谢!


    window.onload = function () {
        document.getElementById('广告容器Id').style.display = /(关键字1|关键字2|关键字3)/i.test(document.body.innerHTML)?'block':'none'
    }



设计自己的搜索网站 <!-- body,td,th { font-size: 12px; } --> function Checktext() { if (document.from.text.value.length == 0 ) { alert("搜索关键字不能为空!"); document.from.text.focus(); return false; } return true; }



要求不清晰,没法回答
是根据一个广告名称或者多个广告名称进行调用广告?
调用一个广告还是多个广告?

你写个if判断不就可以了