function include_file(file, _type, callback) { var _doc = document.getElementsByTagName('head')[0]; var isIE = navigator.userAgent.toUpperCase().indexOf("MSIE") == -1 ? false : true; var _fileObj; if (_type == "script") { _fileObj = document.createElement('script'); _fileObj.setAttribute('type', 'text/javascript'); _fileObj.setAttribute('src', file); _doc.appendChild(_fileObj); if (!isIE) { _fileObj.onload = function () { callback() } } else { _fileObj.onreadystatechange = function () { if (_fileObj.readyState == 'loaded' || _fileObj.readyState == 'complete') { callback() } } } } else if (_type == "css") { _fileObj = document.createElement('link'); _fileObj.setAttribute('type', 'text/css'); _fileObj.setAttribute('rel', 'stylesheet'); _fileObj.setAttribute('href', file); _doc.appendChild(_fileObj); if (!isIE) { callback() } else { _fileObj.onreadystatechange = function () { if (_fileObj.readyState == 'loaded' || _fileObj.readyState == 'complete') { callback() } } } } } jQuery(document).ready(function ($) { include_file("/Css/fanhuidibu.css", "css", function () { // if (!IsLoads("/js/jquery-1.3.2.min.js")) { // include_file("/js/jquery-1.3.2.min.js", "script", action) // } else { // action() // } action(); }) }); function action() { $(document.body).append("
"); $('#roll_top').click(function () { $('html,body').animate({ scrollTop: '0px' }, 800) }); $('#ct').click(function () { $('html,body').animate({ scrollTop: $('.ct').offset().top }, 800) }); $(window).scroll(function (event) { if ($.browser.ie6) { $('#roll').css('top', $(this).scrollTop() + $(this).height() - 170) } if ($(this).scrollTop() > 260) { $('#roll').fadeIn() } else { $('#roll').fadeOut() } }) } function IsLoads(src) { var isLoaded = false; var scripts = document.getElementsByTagName("script"); for (i = 0; i < scripts.length; i++) { if (scripts[i].src && scripts[i].src.indexOf(src) != -1) { if (scripts[i].readyState == "loaded" || scripts[i].readyState == "complete") { isLoaded = true; break } } } return isLoaded }