我在创建的下拉菜单中遇到问题并链接到特定页面。
我遇到的问题是我无法跟踪指向不同页面的链接,因为它试图将浏览器定向到目录中不存在的文件。例如。当我在主页上,然后按下ABOUT菜单并点击我们的团队时,它将直接进入我们的团队页面,但是当我进入我们的团队页面并下拉资源菜单时,它会尝试带我去“ about / resources / whateverpage.php“而不是”/resources/whateverpage.php“
如何实现它实际上将它指向/ resources目录而不是保留在/ about目录中。我已尝试在链接之前使用“../”,但您可以猜测出现问题的位置。
同样,因为我有链接指向/ ourteam.php(例如),当我在ABOUT菜单/目录中,然后我去单击ABOUT菜单中的另一个页面时,它会尝试引导我到/ about / hours.php而不是/ hours.php
谢谢大家。
我的代码如下:
<div id="menu">
<ul><strong>
<li><a href="index.php" accesskey="1" title="">HOME |</a></li>
<li><a href="#" accesskey="2" title="">ABOUT |</a>
<ul>
<li><a href="about/ourteam.php">Our Team</a></li>
<li><a href="about/referralprocess.php">Referral Process </a></li>
<li><a href="about/financialpolicy.php">Financial Policy</a></li>
<li><a href="about/facility.php">Facility</a></li>
<li><a href="about/hours.php">Hours/Directions</a></li>
</ul>
</li>
<li><a href="#" accesskey="3" title="">EMERGENCY SERVICE |</a>
<ul>
<li><a href="emergencyservices/whatwedo.php">What We Do</a></li>
<li><a href="emergencyservices/howstaffed.php">How We Are Staffed</a></li>
<li><a href="emergencyservices/referralemerghandling.php">Emergency/Referral Procedure</a></li>
<li><a href="emergencyservices/typesofemerg.php">Types of Emergencies</a></li>
<li><a href="emergencyservices/whattoexpect.php">What to Expect On Arrival</a></li>
</ul>
</li>
<li><a href="specialtyservices.php" accesskey="4" title="">SPECIALTY SERVICE |</a>
<ul>
<li><a href="specialityservices/criticalcare.php">Critical Care</a></li>
<li><a href="specialityservices/internalmedicine.php">Internal Medicine</a></li>
<li><a href="specialityservices/surgery.php">Surgery</a></li>
<li><a href="specialityservices/rehab.php">Rehab</a><li>
</ul>
</li>
<li><a href="resources.php" accesskey="5" title="">RESOURCES |</a>
<ul>
<li><a href="resources/forms.php">Referral Forms</a></li>
<li><a href="resources/reorder.php">Brochure/Business Card Reorder</a></li>
<li><a href="resources/emergtopics.php">Emergency Topics</a></li>
<li><a href="resources/criticalcaretopics.php">Critical Care Topics</a></li>
<li><a href="resources/internalmedicinetopics.php">Internal Medicine Topics</a></li>
<li><a href="resources/surgerytopics.php">Surgery Topics</a></li>
<li><a href="resources/rehabtopics.php">Rehab & Fitness Topics</a></li>
<li><a href="resources/links.php">Links</a></li>
<li><a href="resources/directions.php">Directions/Map</a></li>
<li><a href="resources/wheretostay.php">Where to Stay</a></li>
<li><a href="resources/newsletter.php">Newsletter</a></li>
</ul>
</li>
<li><a href="communityevents.php" accesskey="6" title="">COMMUNITY EVENTS |</a></li>
<li><a href="careers.php" accesskey="7" title="">CAREERS |</a>
<ul>
<li><a href="careers/surgery.php">Surgery</a></li>
<li><a href="careers/neurosurgery.php">Neurosurgery</a></li>
<li><a href="careers/orthopaedic.php">Orthopaedic</a></li>
</ul>
</li>
<li><a href="contact.php" accesskey="8" title="">CONTACT</a></li>
</strong></ul>
答案 0 :(得分:0)
您需要在链接的前面添加/
。这些是相对的链接。