Irish SEO,  Marketing & Webmaster Discussion

 
Web based billing for freelancers

Correct anchor syntax for xhtml

This is a discussion on Correct anchor syntax for xhtml within the Coding Help forums, part of the Webmaster Help category; What is the compliant code, with regard to xhtml, for; 1)Internal page linking . 2.)Another page on the same server. ...


Go Back   Irish SEO, Marketing & Webmaster Discussion > Webmaster Help > Coding Help

Register Forum Rules FAQDonate Members List Calendar Search Today's Posts Mark Forums Read


Notices

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 15-04-2007, 02:59 AM
Frontpage User
 
Join Date: Feb 2007
Posts: 23
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
lato will become famous soon enough
Default Correct anchor syntax for xhtml

What is the compliant code, with regard to xhtml, for;

1)Internal page linking .
2.)Another page on the same server.
3) Open in a new window.

Upfront, thanks for any definitive answer.
__________________
Arranmore Island
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 15-04-2007, 01:53 PM
daviddoran's Avatar
Wannabe Geek
Recent Blog: iMSISS
 
Join Date: Aug 2006
Location: Meath, Ireland
Posts: 342
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
daviddoran will become famous soon enough
Default

I'm not totally sure what you want answered with the first to, but there goes:
1) To link internally in the page:
Code:
<a href="#anchor" title="Anchor Title">Link to anchor</a>
2) To link to another page:
Code:
<a href="another_page.htm" title="Another Page">Another Page</a>
3) To open new window
Code:
<a href="another_page.html" onclick="window.open(this.href); return false;" title="Another page new">Open in new window!</a>
The third one is strange but is correct because XHTML has deprecated the target attribute and since the window target is deemed an interaction-level element it should either be specified by javascript or CSS (css3 I believe)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 15-04-2007, 07:07 PM
niall's Avatar
Hosting Caretaker
 
Join Date: Jan 2007
Location: Carlow
Posts: 65
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
niall will become famous soon enough
Send a message via ICQ to niall Send a message via MSN to niall
Default

Quote:
Originally Posted by daviddoran View Post
I'm not totally sure what you want answered with the first to, but there goes:
1) To link internally in the page:
Code:
<a href="#anchor" title="Anchor Title">Link to anchor</a>
This might be just a matter of personal taste, but are you not better off using single quotes? My main reasons using single rather than double quotes are:

1. It's faster to type (no shift key required)
2. It's doesn't require escaping in php (no backslash and shift key)

From a quick search, it seems that it should be double quotes (source), but xhtml strict validates with single quotes on the w3c validator.
__________________
Blog
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 15-04-2007, 07:19 PM
daviddoran's Avatar
Wannabe Geek
Recent Blog: iMSISS
 
Join Date: Aug 2006
Location: Meath, Ireland
Posts: 342
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
daviddoran will become famous soon enough
Default

I have always used double-quotes and I think we'd find that 95% of links to aswell.
1) I suppose but it is practically the same since you insert a double-quote with two different hands (I.E. It's still pratically one keystroke)
2) Well, if we want to get pedantic using single-quotes to escape PHP strings is faster for PHP to interpret and because double quotes are wider they are easier to see in the string.

That's my view anyway.

As for quoting attributes both single and double are valid, with similar quoting rules (Singles ok in double, double ok in single)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 16-04-2007, 02:37 AM
Frontpage User
 
Join Date: Feb 2007
Posts: 23
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
lato will become famous soon enough
Default

Thank you Sir,
Open in a new window though?
Can we do this xhtml? rather than js?
And thanks in either case.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6 (permalink)  
Old 16-04-2007, 08:05 AM
louie's Avatar
Senior Member
 
Join Date: Jan 2006
Location: Dublin, Ireland
Posts: 2,048
Nominated 5 Times in 3 Posts
Nominated TOTW/F/M Award(s): 1
louie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enough
Send a message via Yahoo to louie Send a message via Skype™ to louie
Default

yes, you can use
Code:
<a href="page.php" target="_blank" title="you page">Link</a>
and if needed you can do the rezise on the new page with javascript.
__________________
:. Web Design & Development Web Design Ireland
:. Search Engines Optimization Search Engines Optimization
:. Directory Submission Directory Submission
:. News & Press Release Ireland GiveItSocks.com
:. Used Cars Ireland, Car Parts & Car Audio Cars For Sale, Car Parts & Accessories
:. I Have 2 Find It Directory SEF Directory
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7 (permalink)  
Old 16-04-2007, 10:40 AM
Frontpage User
 
Join Date: Feb 2007
Posts: 23
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
lato will become famous soon enough
Default

Great!
Thanks.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8 (permalink)  
Old 16-04-2007, 04:16 PM
daviddoran's Avatar
Wannabe Geek
Recent Blog: iMSISS
 
Join Date: Aug 2006
Location: Meath, Ireland
Posts: 342
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
daviddoran will become famous soon enough
Default

Quote:
Originally Posted by louie View Post
yes, you can use
Code:
<a href="page.php" target="_blank" title="you page">Link</a>
and if needed you can do the rezise on the new page with javascript.
I'm not sure why he asked about XHTML in the first place if he wanted the old HTML answer..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9 (permalink)  
Old 16-04-2007, 04:19 PM
louie's Avatar
Senior Member
 
Join Date: Jan 2006
Location: Dublin, Ireland
Posts: 2,048
Nominated 5 Times in 3 Posts
Nominated TOTW/F/M Award(s): 1
louie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enough
Send a message via Yahoo to louie Send a message via Skype™ to louie
Default

beats me.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10 (permalink)  
Old 20-04-2007, 07:11 PM
Member
 
Join Date: Jan 2006
Location: Dublin, Ireland
Posts: 84
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
SlitheryImp will become famous soon enough
Default xhtml compliant

As David said, target="_blank" is not xhtml (although it is xhtml transitional), here is another idea, and it is xhtml strict compliant. It also uses javascript though...

Weblog Tools Collection » Blog Archive » target=”_blank” XHTML 1.0 Strict Conversion

Last edited by SlitheryImp; 20-04-2007 at 07:13 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
anchor, correct, syntax, xhtml

Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


Sponsored links

Paid On Results


All times are GMT +1. The time now is 04:47 AM.


Powered by: vBulletin Version 3.7.3, Copyright ©2000 - 2008, Jelsoft Enterprises Limited.
Hosted in Ireland by Blacknight - Test your ISP |Irish Hosting Directory| Armchair.ie|Logo by Eden Web Design|Avatars by Afterglow |Latest Blog Entries | VPS HostingAd Management by RedTyger

Search Engine Friendly URLs by vBSEO 3.2.0