Welcome to WebmasterWorld Guest from 50.16.112.199

Forum Moderators: incrediBILL

Display Link for Visitors to Copy.

   
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 !
2:39 pm on Aug 5, 2010 (gmt 0)

WebmasterWorld Administrator incredibill is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



Code it in javascript document.write commands so the validator doesn't see the HTML, only the end user does.
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!
2:58 pm on Aug 5, 2010 (gmt 0)

WebmasterWorld Senior Member jimbeetle is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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.
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)?
6:18 pm on Aug 5, 2010 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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 &.
6:29 pm on Aug 5, 2010 (gmt 0)

WebmasterWorld Senior Member jimbeetle is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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.
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
 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month