简体   繁体   中英

javascript and css file not working after using ajax xmlhttprequest object

i have a gallery page it is working properly that i want but after using ajax XMLHttpRequest object, image caption and slideshow not working, basically css and javascript file not working fine.

  <script>
        function filterSelection(data) {
            var xmlhttp;
            if (window.XMLHttpRequest) {
                xmlhttp = new XMLHttpRequest();
            } else {// code for IE6, IE5
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlhttp.onreadystatechange = function () {
                if (xmlhttp.readyState === 4 && xmlhttp.status === 200) {
                    // change content from div
                    document.getElementById("imageContainer").innerHTML = xmlhttp.responseText;
                }
            };
            xmlhttp.open("GET", "get.php?menu_title=" + data, true);
            xmlhttp.send();
        }
    </script>

不确定CSS为什么不起作用,但是就JavaScript而言,最有可能的原因是,在用innerHTML对内容进行innerHTML您将不得不使用新的HTML重新初始化JavaScript库。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM