Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-23-2011, 10:01 PM   PM User | #1
orwel84
New Coder

 
Join Date: Oct 2009
Location: London
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
orwel84 is an unknown quantity at this point
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
orwel84 is offline   Reply With Quote
Old 03-24-2011, 06:50 AM   PM User | #2
leapinglemur55
New Coder

 
Join Date: Jan 2011
Location: California
Posts: 20
Thanks: 0
Thanked 5 Times in 5 Posts
leapinglemur55 is an unknown quantity at this point
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).
leapinglemur55 is offline   Reply With Quote
Old 03-24-2011, 07:06 AM   PM User | #3
Excavator
Master Coder


 
Excavator's Avatar
 
Join Date: Dec 2006
Location: Alaska
Posts: 9,410
Thanks: 22
Thanked 1,765 Times in 1,749 Posts
Excavator has a spectacular aura aboutExcavator has a spectacular aura aboutExcavator has a spectacular aura about
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
Excavator is offline   Reply With Quote
Old 03-24-2011, 08:44 AM   PM User | #4
orwel84
New Coder

 
Join Date: Oct 2009
Location: London
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
orwel84 is an unknown quantity at this point
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..
orwel84 is offline   Reply With Quote
Old 03-24-2011, 08:46 AM   PM User | #5
orwel84
New Coder

 
Join Date: Oct 2009
Location: London
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
orwel84 is an unknown quantity at this point
I had also tried to use the _self tag, but still and issue!

orwel84 is offline   Reply With Quote
Old 03-24-2011, 12:32 PM   PM User | #6
mentaljason
New to the CF scene

 
Join Date: Mar 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
mentaljason is an unknown quantity at this point
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.
mentaljason is offline   Reply With Quote
Old 03-24-2011, 01:53 PM   PM User | #7
VIPStephan
The fat guy next door


 
VIPStephan's Avatar
 
Join Date: Jan 2006
Location: Halle (Saale), Germany
Posts: 7,600
Thanks: 5
Thanked 865 Times in 842 Posts
VIPStephan is a jewel in the roughVIPStephan is a jewel in the roughVIPStephan is a jewel in the rough
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.
__________________
Don’t click this link!
VIPStephan is offline   Reply With Quote
Reply

Bookmarks

Tags
html, hyperlinks, menu's, tabs, target blank

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:07 AM.


Advertisement
Log in to turn off these ads.