473,397 Members | 1,950 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Validating <textarea>

Hi. I hope someone here can help. I'm webmaster for a local astronomy
club. Just went over our web site. Have validated every htm file on the
site except:
http://validator.w3.org/check?uri=ht.../mas/COMET.htm

In the <textarea> of this page I have Javascript code. I can't figure out
how to present this code and still be w3c valid. Any advice would be
appreciated...Dennis
Jul 20 '05 #1
4 4291
"Dennis Allen" <de****@dennisallen.com> wrote in message
news:10*************@corp.supernews.com...
Hi. I hope someone here can help. I'm webmaster for a local astronomy
club. Just went over our web site. Have validated every htm file on the
site except:
http://validator.w3.org/check?uri=ht.../mas/COMET.htm

In the <textarea> of this page I have Javascript code. I can't figure out
how to present this code and still be w3c valid. Any advice would be
appreciated...Dennis


Do a search and replace on the code inside the textarea, and change all
opening angle brackets ("<") to "&lt;" and all closing angle brackets (">")
to "&gt;". The code will validate, and the text inside the textarea will
appear the same.

Christopher Finke
Jul 20 '05 #2
"Dennis Allen" <de****@dennisallen.com> wrote:
Have validated every htm file on the
site except:
http://validator.w3.org/check?uri=ht...g.net/mas/COME
T.htm
That's not an "htm file" but a reference to a validator so that the URL
of a page is passed to it. Actually, not even that, since
"Within a query component, the characters ;, /, ?, :, @, &, =, +, ,,
and $ are reserved." (RFC 2396), so the reference is syntactically
malformed.
In the <textarea> of this page I have Javascript code. I can't
figure out how to present this code and still be w3c valid.


Why do you use a form input field when you don't want any user input?

Just put the Javascript code into a separate file and link to it, on a
page that explains what the code does, if you think the code is useful.
If the user's browser starts actually executing Javascript code when he
follows the link, then this will be a useful lesson, and a cheap one as
compared with the possibility of following an innocent-looking link
using a Javascript-enabled browser.

If you insist on embedding Javascript code as visible text onto your
HTML document, then make it really visible, inside <pre> element for
example, instead of forcing the user play with a separately scrollable
area inside a scrollable window.

In any case, any "<" and "&" as data characters in HTML should be
written as "&lt;" and "&amp;". (Using "&gt;" for ">" is never required
by HTML rules, but you might do it for symmetry, or to cope with some
assumed bugs in ancient browsers.) A rhetorical question: are you
qualified to make recommendations to other people about what they
should put into their HTML documents, if you were not able to figure
out this elementary HTML thing on your own?

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 20 '05 #3
Just want I needed to know. Thanks...Dennis

"Christopher Finke" <ch**************@hotmail.com> wrote in message
news:bu************@ID-158177.news.uni-berlin.de...
"Dennis Allen" <de****@dennisallen.com> wrote in message
news:10*************@corp.supernews.com...
Hi. I hope someone here can help. I'm webmaster for a local astronomy
club. Just went over our web site. Have validated every htm file on the site except:
http://validator.w3.org/check?uri=ht.../mas/COMET.htm
In the <textarea> of this page I have Javascript code. I can't figure out how to present this code and still be w3c valid. Any advice would be
appreciated...Dennis
Do a search and replace on the code inside the textarea, and change all
opening angle brackets ("<") to "&lt;" and all closing angle brackets

(">") to "&gt;". The code will validate, and the text inside the textarea will
appear the same.

Christopher Finke

Jul 20 '05 #4
That's what I need to know. Thanks...Dennis

"Jukka K. Korpela" <jk******@cs.tut.fi> wrote in message
news:Xn*****************************@193.229.0.31. ..
In any case, any "<" and "&" as data characters in HTML should be
written as "&lt;" and "&amp;". (Using "&gt;" for ">" is never required
by HTML rules, but you might do it for symmetry, or to cope with some
assumed bugs in ancient browsers.) A rhetorical question: are you
qualified to make recommendations to other people about what they
should put into their HTML documents, if you were not able to figure
out this elementary HTML thing on your own?

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Matt | last post by:
Simple vbscript,html page loading into access. Input pg posting to Confirm pg, then sending to access. when using; <textarea name="name" tabindex="15"> </textarea> as an input renders tab...
1
by: Augustus | last post by:
Hiya, I have a form with a <textarea></textarea> to receive user input. This input is then stored in a database and sent by fax... I need to be able to remove the carriage returns (enter...
2
by: Jonathan Taub | last post by:
This may seem a stupid question. I've got a <textarea> element: .... <td> List of items: <textarea> 1. Apple 2. Orange 3. Box
16
by: Martin Trautmann | last post by:
Hi all, I just had a problem where Mozilla 1.6 did not accept a XHTML 1.0 page that contained <p><textarea cols="50" name="prod_prob_description" rows="4" /></p> It did not accept the end...
11
by: Les Paul | last post by:
I'm trying to design an HTML page that can edit itself. In essence, it's just like a Wiki page, but my own very simple version. It's a page full of plain old HTML content, and then at the bottom,...
3
by: Jarek Mielcarek | last post by:
hi all, in xml file I have some fields which are source for <textarea> element. I'd like to transform this file using xslt and set the rows property of <textarea> depend of lines in some source...
8
by: ASP Yaboh | last post by:
I have an ArrayList of data gathered from a database. I want to create a web page from this data by creating a <table>, each cell in each row displays the appropriate data. One of those cells in...
6
by: Tony | last post by:
The w3schools HTML tag reference for <textarea> http://www.w3schools.com/tags/tag_textarea.asp says that the attributes 'cols' and 'rows' are REQUIRED attributes for the textarea tag. Looking at...
3
by: FunkHouse9 | last post by:
I'm working on a form to collect data in a textarea which and am trying to keep returns and spaces. I have a couple of functions that I Frankensteined together to replace returns with <br> and to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.