简体   繁体   English

HTML链接不起作用

[英]HTML links not working

I created my first website uploading the first two pages including the first and main page and then a second page that the first page links to. 我创建了第一个网站,上传了前两个页面,包括第一页和主页,然后上传了第二个页面,这些页面链接到该页面。 Before doing so, a link that when clicked on, takes me correctly from my main page to a second page worked. 在执行此操作之前,单击一个链接即可正确地将我从主页转到第二页。 After uploading it on 000webhost.com it no longer worked. 将其上传到000webhost.com后,它不再起作用。 Meaning, I can view my main page but when I click on the link that should take me to my second page, it doesn't do anything. 意思是,我可以查看我的主页,但是当我单击应该带我到第二页的链接时,它没有任何作用。 Here is the code that was and is still included in my main page for the link that should take me to my second page. 这是我的主页中曾经并且现在仍包含的代码,该链接应将我带到第二页。 I have a feeling that it has something to do with the protocol and that I have to make changes to it but not sure what changes to correctly make so the link will work. 我感觉它与协议有关,我必须对其进行更改,但是不确定要正确进行哪些更改才能使链接正常工作。 I used a sub domain at 000webhost.com not my own. 我在000webhost.com上使用了一个子域,而不是我自己的。 Here is the code that was and is on my main page: 这是我主页上过去的代码:

<li><a href="file:///C:\Users\Brian\Desktop\Noah\NoahsFirstDay.html">Noah's First Day</a></li>

The link points to a file on your computer (note the file:// prefix). 该链接指向您计算机上的file:// (请注意file://前缀)。 The best practice is usually to have links to your own pages in relative form. 最佳做法通常是以相对形式链接到您自己的页面。 So, for example, assuming you uploaded all the files to the same directory, just use the filename itself: 因此,例如,假设您将所有文件上传到同一目录,则只需使用文件名本身即可:

<li><a href="NoahsFirstDay.html">Noah's First Day</a></li>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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