Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Oct 2009
    Location
    London
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy how to stop a href links opening in a new tab???

    Hi All,

    I have been building a site for a frind, all is going well, building the seperate pages, all validating etc . . .
    Today i linked them all up through the navigation, and for some reason, every time a click onto a new page link (site navigation) it opens up the page in a new tab.
    I have looked at everything, checked and double checked . . . its freaking me out!

    Here is the code :

    Code:
    <!-- navigation -->
    <div class="drop">
    <h4 class="title">Practice</h4>
    <ul class="sub">
    <li><a href="profile.html">Profile</a></li>
    <li><a href="people.html">People</a></li>
    <li><a href="careers.html">Careers</a></li>
    </ul>
    <h4 class="title">Projects</h4>
    <ul class="sub">
    <li><a href="commercial.html">Commercial</a></li>
    <li><a href="residential.html">Residential</a></li>
    <li><a href="education.html">Education</a></li>
    </ul>
    <h4><a href="news.html"><span>News</span></a></h4>
    <h4><a href="contact.html"><span>Contact</span></a></h4>
    </div>
    Any help would be great!


    Thanks

  • #2
    New Coder
    Join Date
    Jan 2011
    Location
    California
    Posts
    20
    Thanks
    0
    Thanked 5 Times in 5 Posts
    Do you have a working version of the whole page that you can post? I don't see any problems with what you have there.
    --------------------------------------------------------
    Still learning (hopefully not too obvious).

  • #3
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,667
    Thanks
    22
    Thanked 1,826 Times in 1,810 Posts
    Hello orwel84,
    Where a link opens is really up to the browsers settings and forcing it to open in the same or a new browser is taking functionality away from the end user.

    Have a look at the target attribute here.

    See how evil the target attribute really is here.
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #4
    New Coder
    Join Date
    Oct 2009
    Location
    London
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi Thanks,

    Yes, it is very odd . . . as all seems fine.

    Leapinglemur - here is the full page -

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html lang="en-US" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="description" content="Form Architecture covering London and Essex" />
    <meta name="keywords" content=" " />
    <title></title>
    <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" />
    <link rel="stylesheet" href="slide.css" type="text/css" media="screen" />
    <link rel="icon" href="images/favicon.ico" type="image/jpg" />
    
    <script type="text/javascript" src="scripts/jquery.js"></script>
    <script type="text/javascript" src="scripts/menu.js"></script>
    <script type="text/javascript" src="scripts/menu2.js"></script>
    <script type="text/javascript" src="scripts/jquery.nivo.slider.js"></script>
    <script type="text/javascript" src="scripts/scroll.js"></script>
    <script type="text/javascript">
    $(document).ready(function()
    {
    var i = 0;
    
    $('#three').each(function()
    {
    var me = this;
    $(this).hide()
    var j = i;
    setTimeout(function()
    {
    $(me).fadeIn(1000);
    }, i)
    i += 100
    });
    });
    </script>
    
    </head>
    <body>
    <div id="container">
    <div id="box">
    <!-- logo -->
    <div class="logo"><a href="index.html"><img src="images/all/logo.gif" alt="----" border="0" /></a></div>
    
    <!-- navigation -->
    <div class="drop">
    <h4 class="title"><span>Practice</span></h4>
    <ul class="sub">
    <li><a href="profile.html">Profile</a></li>
    <li><a href="people.html">People</a></li>
    <li><a href="careers.html">Careers</a></li>
    </ul>
    <h4 class="title">Projects</h4>
    <ul class="sub">
    <li><a href="commercial.html">Commercial</a></li>
    <li><a href="residential.html">Residential</a></li>
    <li><a href="education.html">Education</a></li>
    </ul>
    <h4><a href="news.html"><span>News</span></a></h4>
    <h4><a href="contact.html"><span>Contact</span></a></h4>
    </div>
    <!-- end #drop -->
    
    <div class="logo"><a href="index.html"><img src="images/all/logo2.gif" alt="---" border="0" /></a></div>
    </div>
    <!-- end #box -->
    <div id="content">
    <div id="three">
    <div class="wide">
    <img src="images/long.jpg" alt="----" height="180" width="780"/>
    </div>
    <div class="col1">
    <h1>Contact</h1>
    </div>
    <div class="col1">
    <p></p>
    </div>
    <div class="col4">
    <div class='scroll-pane'>
    <!-- form -->
    <div id="contact-area">
    <div class="contactform">
    <p>Fields marked * are required</p>
    <form method="post" action="contact.php">
    <p>Name:*</p>
    <input type="text" name="Name" />
    <p>Email:*</p>
    <input type="text" name="Email" />
    <p>Contact number:*</p>
    <input type="text" name="ContactTel" />
    <p>Subject:*</p>
    <input type="text" name="Subject" />
    <p>Enquiry:*</p>
    <textarea name="Enquiry" rows="5" cols="35">
    </textarea>
     <input type="submit" name="submit" value="Submit" class="submit-button" /></form>
    </div>
    </div>
    </div>
    </div>
    </div>
    </div>
    <!-- end #content -->
    <div id="footer">
    <p class= "footer">© 2011</a></p>
    </div>
    <!-- end #footer -->
    </div>
    <!-- end #container -->
    </body>
    </html>
    And excavator, thanks for the link, i had looked into this, but have tried acoss firefox, safari and chrome, all the same issue, so dont think it is a browser setting . . . .

    I mean ususaly, the cose i have works perfectly, in fact i actually have another ite with an accordian menu, and there are no issues!

    Thanks
    Last edited by orwel84; 03-24-2011 at 09:47 AM.

  • #5
    New Coder
    Join Date
    Oct 2009
    Location
    London
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I had also tried to use the _self tag, but still and issue!


  • #6
    New to the CF scene
    Join Date
    Mar 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm not sure if it matters to your problem but,
    Code:
    <p class= "footer">© 2011</a></p>
    I wouldn't use the symbol.. Sometimes when I use symbols like that they get repaced with ? when I save, I have to use &copy; Not sure if your way is better than mine though...

    Onto your problem, The a href shouldn't do that the way they are, But.... In your stylesheet or js you could have set a href's to do that? but as they are right there they wouldn't do that, Check your css file. If that doesn't work then check if othersites links also do this, could be your settings.
    Last edited by mentaljason; 03-24-2011 at 12:35 PM. Reason: Adding relevant infomation.

  • #7
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,471
    Thanks
    6
    Thanked 980 Times in 953 Posts
    Quote Originally Posted by mentaljason View Post
    I'm not sure if it matters to your problem but,
    Code:
    <p class= "footer">© 2011</a></p>
    I wouldn't use the symbol.. Sometimes when I use symbols like that they get repaced with ? when I save, I have to use &copy; Not sure if your way is better than mine though...
    Thatís an issue with the character encoding of the file then. You should always save your files as UTF-8 (i. e. make sure that in your code editor UTF-8 is set as standard character encoding of your files and/or make sure it is set to that when saving the file(s)), and also indicate that you use UTF-8 by putting the respecive meta value into the HTML.

    But besides that there is a very obvious error in the above HTML: a closing anchor tag which isnít open.


  •  

    Tags for this Thread

    Posting Permissions

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