SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jan 2014
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Href target div tag

    Dear Friends,

    I have used two divisions. In one division I have menu list. whenever I select the Menu Item from the first division, automatically the html file which associated with that Menu Item has to display in the second division. The code is here:
    <html>
    <head>
    <title>
    </title>
    </head>
    <div id="navigation">
    <a href="Home.html">home</a>
    <a href="services.html">Services</a>
    <a href="contact.html">Contact</a>
    </div>
    <div id="conten">
    Initially some text
    </div>

    I tried with iframe, but it is not perfect and also it has few drawbacks. Please help me with divisions only.

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,832
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    To target any id (eg id="any") in the same page use the same id in the href after a # (eg href="#any")

    If in a different page then the address of the page goes in front of the #.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,206
    Mentioned
    456 Post(s)
    Tagged
    8 Thread(s)
    Hi K. CHANDRA SEKHA. Welcome to the forums.

    A common way to do this is with Ajax. Here is a recent thread that shows how to do it with and without a JavaScript library:

    http://www.sitepoint.com/forums/show...ain-JavaScript


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •