Javascript文件在github页面上不起作用 [英] Javascript file not working on github pages

查看:132
本文介绍了Javascript文件在github页面上不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能够在本地计算机上加载我的JavaScript文件.但是在github页面上,它不起作用.

I am able to load my javascript file on the local machine. But on github pages, it is not working.

我已将文件包含在index.html中作为

I have included the file in index.html as

<script src="script.js" type="text/JavaScript"/>

该网站为 https://abhikulshrestha22.github.io./

代码位于 https://github.com/abhikulshrestha22/abhikulshrestha22.github.io

任何帮助将不胜感激.预先感谢.

Any help would be appreciated. Thanks in advance.

编辑1 我试图在我的javascript文件中添加以下代码,以检查其是否正常运行,但是在github页面上却无法正常工作,并且无法在本地正常工作.

Edit 1 I tried to add the following code in my javascript file to check if its working, but it is not working on github page and working locally.

$(document).ready(function(){
    alert("hi");}

推荐答案

尝试一下

<script src="script.js" type="text/javascript"></script>

使用结束script标记.

有关更多信息,请参见 answer .

For more check this answer.

这篇关于Javascript文件在github页面上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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