Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML

I'm trying to anchor a button of a dropdown menu but when i press the button, it says it cant find the file

This is my code,

<div class="dropdown">
  <button onclick="myFunction()" class="dropbtn">The Four Pathways</button>
  <div id="myDropdown" class="dropdown-content">
    <a href="computerscience">Computer Science</a>
    <a href=“page3.html”>Clean Energy</a>
    <a href=“page4.html”>Entrepreneur & Leadership</a>
    <a href=“page5.html”>Mechatronics</a>
  </div>
</div>

I've looked at the path of the link and the file is where the computer is looking, but it says is has either been deleted or moved.

4 Answers

Nolan, I'm not sure if when you're clicking the dropdown button it's saying it can't find the file, or when you click the computer science link? Seems like in the computer science link is not referencing the right file. You probably need to add .html at the end of computerscience like this:

<a href="computerscience.html">Computer Science</a>

Hi Nolan, are you calling your script from an external file, or are you putting it inside the head tags or after the closing body tag?

i have it as an external file because its going to be a separate page of a website. When i checked the path the code was taking it went directly to where the file was.

thank you very much that solved my problem

I'm glad I could help!