1.在html页面中引入jQuery.min.js,版本最好用1.2版以上的
2.searchNull.js代码如下
function validate() {
            //var content = $("#content").html();
            var noContent = $("#no_content").html();
            // if (content == null || content.length == 0) {
            //     alert("content:" + conten);
            // }
            if (noContent == null || noContent.length == 0) {
            	$("#no_content").append("<p>对不起,没有相关的查询结果</p>");
                alert("对不起,没有相关的查询结果");
                window.location.href='/Shop';
            }
        }
        window.onload = function () {
            validate();
        }  3.用法如下
先引入jQuery和searchNull.js
再在html页面中的任意一个div上添加id属性为no_content
示例:
<div id="no_content">
</div>



京公网安备 11010502036488号