homepage Welcome to WebmasterWorld Guest from 54.226.213.228
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
Display Link for Visitors to Copy.
andynick




msg:4182485
 2:28 pm on Aug 5, 2010 (gmt 0)

I want people to be able to link to my site from theirs.
For some time now, I've used a textarea :

<textarea class="lk-cde"><a href="http://www.workingsheepdog.co.uk" target="_blank">The Working Sheepdog Website: Border Collie Training - Information - Pictures & DVDs</a>.</textarea>

You've guessed it, this won't validate - W3 doesn't like the <a being inside the textarea (document type does not allow element "A" here) so I've been searching around (so far without success) to find how to do it properly.

Can anyone help please !

 

incrediBILL




msg:4182497
 2:39 pm on Aug 5, 2010 (gmt 0)

Code it in javascript document.write commands so the validator doesn't see the HTML, only the end user does.

andynick




msg:4182503
 2:49 pm on Aug 5, 2010 (gmt 0)

Code it in javascript document.write commands so the validator doesn't see the HTML, only the end user does.


Thanks . . . sounds great (I'd love to) but I don't have the foggiest idea how to do that!

jimbeetle




msg:4182510
 2:58 pm on Aug 5, 2010 (gmt 0)

There are two other options:

1) The validator is wrong. I look at it as anything included in textarea should be treated as text -- not an element.

2) Simply ignore it. Unless there are other reasons to have absolutely valid code, as long as you know why it doesn't validate and it works, use it.

andynick




msg:4182520
 3:12 pm on Aug 5, 2010 (gmt 0)

Thanks again for the very quick (and helpful) responses.
anything included in textarea should be treated as text -- not an element

This makes sense to me.

Simply ignore it. Unless there are other reasons to have absolutely valid code, as long as you know why it doesn't validate and it works, use it

Sounds good too - but I rather hoped to validate every page . . .

It's not of vital importance but is this javascript too complicated for a country boy (who struggles a bit with CSS)?

rocknbil




msg:4182658
 6:18 pm on Aug 5, 2010 (gmt 0)

Actually, I do this completely differently, and you're fortunate that it didn't do a premature end. :-) Raw HTML in a text area can sometimes cause entire sections of a page disappear, it thinks the textarea content is an attribute of the <textarea>.

A solution to both, entity the carats and the quotes. When they copy it, it should still copy as < and ".

<textarea class="lk-cde">&lt;a href=&quot;http://www.workingsheepdog.co.uk&quot; target=&quot;_blank&quot;&gt;The Working Sheepdog Website: Border Collie Training - Information - Pictures &amp; DVDs&lt;/a&gt;.</textarea>

Don't forget the raw &.

jimbeetle




msg:4182667
 6:29 pm on Aug 5, 2010 (gmt 0)

Raw HTML in a text area can sometimes cause entire sections of a page disappear...

I've never noticed that but it's good to know the way it should be done. And it's a simple fix. Thanks.

andynick




msg:4182682
 6:49 pm on Aug 5, 2010 (gmt 0)

A solution to both, entity the carats and the quotes. When they copy it, it should still copy as < and ".

I'm stunned . . . thank you so much for that.
Andy

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved