为什么我的javascript文件没有链接?

 王老虎在江湖 发布于 2023-02-04 21:01

这是我第一次尝试让我的jQuery代码在codeacademy.com以外的地方工作,所以请耐心等待.

我有三个文件,index.html,stylesheet.css和script.js(加上几张图片)都在同一个文件夹中.index.html和style.css相互配合得很好,但是无论我放入什么内容,script.js似乎根本不想采取任何效果(使用命令就像在$上隐藏段落一样简单(文档) ).准备...

这是index.html:




    Title
    
    



test test test

Hi I'm James

I live in Seattle

I like tinkering

and I really like coffee

这是stylesheet.css:

a {
    text-decoration:none;
}

body {
    background-image: url("debut_light.png");
}
.mainh1 {
    text-align: left;
    font-family: 'Cantora One', sans-serif;
    color: #556270;
    font-size: 25px;
    text-shadow: 0 2px 0 #fff;
    margin: 0;
    margin-top: 75px;
    margin-left: 25px;
    line-height: 150%;
    display: inline-block;
}

#email {
    color: #03738E;
}

#city {
    color: #F1B703;
}

#tinker {
    color: #F15B07;
}

#coffee {
    color: #D92D01;
}

.image {
    height: 400px;
    width: 400px;
    float: right;
    overflow: hidden;
    margin-top: 75px;
    margin-right: 50px;
    border-radius: 20px;
}

.image img {
    width: 100%;
    height: 100%;
}

这是script.js:

$(document).ready( function() {
    $('p').fadeOut('slow');
});

我也尝试链接script.js的整个源路径,我尝试将它上传到hostgator.com上的服务器但无济于事.知道为什么我的jquery不工作吗?如果这是一个简单的错误,请耐心等待,这是我编码的第5天.

1 个回答
  • 你还没有加载jQuery.在加载脚本之前添加此代码:

    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    

    2023-02-04 21:06 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有