p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/)
-   BOOK: Beginning HTML, XHTML, CSS, and JavaScript (http://p2p.wrox.com/book-beginning-html-xhtml-css-javascript-541/)
-   -   Problem Linking back to same page (http://p2p.wrox.com/book-beginning-html-xhtml-css-javascript/92540-problem-linking-back-same-page.html)

ananta1990 March 28th, 2014 08:25 AM

Problem Linking back to same page
 
Hello folks!!!

Its very irritating but I had once easily linked back to links on same page. but somehow this isn't working now.Any help in debugging the following code?
Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
  <title>Example Cafe-community cafe in Newquay,Cornwal,UK</title></head>
<body>
<h1>Example Cafe</h1>
<a href=“index.html”>HOME</a>
MENU
<a href=“recipes.html”>RECIPES</a>
<a href=“contact.html”>CONTACT</a>
<p>
<h2><a id=“top”>Example Cafe Menu</a></h2>
<h2><a id=“starters”>Starters</a></h2>
<h2><a id=“main courses”>Main Courses</a></h2>
<h2><a id=“desserts”>Desserts</a></h2>
<a href=“#starters”>Starters</a>|
<a href=“#maincourses”>Main Courses</a>|
<a href=“#desserts”>Desserts</a>
</p>
<h2>Menu</h2>
<h2><a id=“starters”>Starters</a></h2>
<ul>
<li>Chestnut and mushroom Goujons</li>
<li>Paneer Chatpati</li>
<li>Mushroom Fry</li>
<li>Chicken Lollipop</li>
</ul>
<p><small><a href=“#top”>Back to top</a></small></p>

<h2><a id=“starters”>Starters</a></h2>
<ul>
<li>Spinach and ricotta roulade</li>
<li>Beef tornado with mustard</li>
<li>Veg Hakka</li>
<li>Chicken Fried Rice</li>
</ul>
<p><small><a href=“#top”>Back to top</a></small></p>

<h2><a id=“desserts”>Desserts</a></h2>
<ul>
<li>Fruit Delight</li>
<li>Milkshake</li>
<li>Cheesecake</li>
<li>Vanilla creamsticks</li>
</ul>
<p><small><a href=“#top”>Back to top</a></small></p>

</body>
</html>


bitnap March 29th, 2014 12:26 PM

Try deleting the h2 elements at the top of the page. The id attributes will conflict with those later down the page.

And in the body of the page you seem to have the starters repeated.

Hope that helps!

ananta1990 March 29th, 2014 02:19 PM

I got the issue rectified. Used the
Code:

name
attribute instead of
Code:

id
attribute. HOwever , still uable to figure out why the id attribute didn't function. [:o]


All times are GMT -4. The time now is 07:15 PM.

Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
2013 John Wiley & Sons, Inc.