jQuery和所有.js文件不在本地工作,只在外部工作 [英] jQuery and all .js files not working locally, only externally

查看:70
本文介绍了jQuery和所有.js文件不在本地工作,只在外部工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个奇怪的问题。我正在编写一个网站并包含jQuery和一些插件,这些插件存储在'js'文件夹中。当我尝试通过浏览器jQuery打开它时,插件和我的所有自定义脚本都无法正常工作。也许它与我的代码有些混淆,但不这么认为。当然,当我在外部使用jQuery(Google API)时它可以工作,但是有一些插件和脚本没有在其他地方托管。这是我的'头'标签。

I've got a strange problem. I'm coding a website and inlcuding jQuery and some plugins, that are stored in 'js' folder. When I try to open it through a browser jQuery, plugins and all my custom scripts aren't working. Maybe it's somehing with my code, but don't think so. Of course when I inlude jQuery externally (Google API's) it works, but got some plugins and scripts which aren't hosted elsewhere. Here's my 'head' tag.


    <title>TOMTRANS - International Transport</title>

    <!-- CSS -->
    <link rel="stylesheet" type="text/css" href="css/style.css" media="screen" />

    <!-- S3Slider CSS -->
    <link rel="stylesheet" type="text/css" href="css/s3slider.css" media="screen" />

    <!-- jQuery -->
    <script type="text/javascript" src="js/jquery-1.6.2.min.js"></script>

    <!-- jQuery Effects -->
    <script type="text/javascript" src="js/functions.js"></script>

    <!-- S3Slider -->
    <script type="text/javascript" src="js/s3Slider.js"></script>

    <!-- S3Slider Init -->
    <script type="text/javascript">
        $(function() {
            $('#s3slider').s3Slider({
                timeOut : 3000,
                });
            });
    </script>

    <!-- HTML5 Shiv -->
    <!--[if lt IE 9]>
    <script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->


推荐答案

通过本地你做表示本地Web服务器(即 http:// localhost:12345 / )或文件系统(即file:// /C:/Users/John/Desktop/hello.htm)?如果是后者,则可能是安全设置。某些浏览器默认阻止文件系统中的脚本。

By locally do you mean a local web server (i.e. http://localhost:12345/) or the file system (i.e. file:///C:/Users/John/Desktop/hello.htm)? If it's the latter, then it's probably the security settings. Some browsers block scripts from the file system by default.

这篇关于jQuery和所有.js文件不在本地工作,只在外部工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆