How do I validate this html?

Lightnote

New member
i'm gonna kick myself if the answer is really simple.

<textbox>
<a href="#">
<img src="an-image.jpg" alt="image" />
</a>
</textbox>

My problem is I don't want the code to execute hence me putting it in a textbox but when I try to validate it, it doesn't like it very much.
What I am trying to accomplish with this is to be able to have a piece of code others can copy & paste into their site/myspace etc...

I don't like the solution I came up with which is to comment out the code in the textbox. If someone where to copy and paste the code it wouldn't appear unless they removed the comments.

I dont want a mass of code because that seems unnecessary for such a simple task.

I've already tried the <pre> tag and the <xmp> tag but the code executes when I use these so I can see the image not the code on the page.

thanks
<textarea rows="10" cols="40">

The textarea has the rows and cols as well just forgot to put them in the example above.
Thanks Joshua J

Glad it was as simple as that. That never even occured to me.
 
You could use the "& g t;" and "& l t;" character entities intead of "<" and ">"

That would also eliminate the need for a textarea.
 
In the fragment that you want displayed "as-is" rather than interpreted as part of the page definition, you need to translate special symbols used by HTML into "entities". These are the &; delimited named characters like < for <, > for >, etc.

If you use your browser to view the HTML source of this page, you'll see your example coded as:

<textbox><br>
<a href="#"><br>
<img src="an-image.jpg" alt="image" /><br>
</a><br>
</textbox><br>


And when you paste it from the browser-rendered page it shows up as:

<textbox>
<a href="#">
<img src="an-image.jpg" alt="image" />
</a>
</textbox>

That sounds like what you want to do. As you can see, Yahoo! Answers gets by by only replacing < > and ", so that's not too many find-and-replace operations, it it?

You may also want to replace ampersands (&) with &
 
In the fragment that you want displayed "as-is" rather than interpreted as part of the page definition, you need to translate special symbols used by HTML into "entities". These are the &; delimited named characters like < for <, > for >, etc.

If you use your browser to view the HTML source of this page, you'll see your example coded as:

<textbox><br>
<a href="#"><br>
<img src="an-image.jpg" alt="image" /><br>
</a><br>
</textbox><br>


And when you paste it from the browser-rendered page it shows up as:

<textbox>
<a href="#">
<img src="an-image.jpg" alt="image" />
</a>
</textbox>

That sounds like what you want to do. As you can see, Yahoo! Answers gets by by only replacing < > and ", so that's not too many find-and-replace operations, it it?

You may also want to replace ampersands (&) with &
 
Back
Top