473,396 Members | 2,020 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,396 software developers and data experts.

how to display whatever the user types in a textarea

We have an input field which allows the user to enter a string of (up
to 62) ASCII printable characters. We have a need to allow the user to
be able to specify any sequence of characters he/she desires.

However, we have a problem when we attempt to display this same string
of characters. If the input sequence of characters contains HTML
interpretable strings of characters, the user's sequence of characters
is not properly displayed. (We are using <td>string</td> to display the
string.)

For example:
If the user enters "ID-12<DALLAS>\STV"
the string is displayed as "ID-12\STV"

The problem is that the text "<DALLAS>" is being interpreted as an HTML
tag. We can circumvent this problem by pre-parsing the display string
and replacing the "<" with "&lt;", resulting in the proper display of
the string.

However, there is a very long list of standard HTML characters whose
mnemonic and/or numeric representations are translated by HTML for
display purposes.

For example:
If the user enters "ID-12&iexcl;" or "ID-12¡"
the user expects the string to be displayed as "ID-12&iexcl;" or
"ID-12¡", not "ID-12!" (where the "!" actually represents an
inverted exclamation point).

We have tried to display the user's string with <PRE>string</PRE>,
<CODE>string</CODE>, <BLOCKQUOTE>string</BLOCKQUOTE> and even the
deprecated <LISTING>string</LISTING> to no avail. Even though our
reference text implies that the sequence of characters between <PRE>
and </PRE> will not be interpreted by HTML, both of our browsers (MS
and Netscape) do interpret the characters.

Is there any way to display a sequence of characters without the
browser interpreting the sequence of characters?
Thanks,
Siva

Nov 23 '05 #1
2 1962
<s.********@gmail.com> wrote:
Is there any way to display a sequence of characters without the
browser interpreting the sequence of characters?


See http://www.htmlhelp.com/faq/html/basics.html#show-html

Darin McGrew, mc****@stanfordalumni.org, http://www.rahul.net/mcgrew/
Web Design Group, da***@htmlhelp.com, http://www.HTMLHelp.com/

"The early bird gets the worm, but the second mouse gets the cheese."
--
Darin McGrew, mc****@stanfordalumni.org, http://www.rahul.net/mcgrew/
Web Design Group, da***@htmlhelp.com, http://www.HTMLHelp.com/

"The early bird gets the worm, but the second mouse gets the cheese."
Nov 23 '05 #2
s.********@gmail.com wrote:
The problem is that the text "<DALLAS>" is being interpreted as an HTML
tag. We can circumvent this problem by pre-parsing the display string
and replacing the "<" with "&lt;", resulting in the proper display of
the string.

However, there is a very long list of standard HTML characters whose
mnemonic and/or numeric representations are translated by HTML for
display purposes.
one, two, many ;)
There are in fact only three characters that must be encoded: '<', '>' and
'&'. A pretty long list, I must admit...
For example:
If the user enters "ID-12&iexcl;" or "ID-12¡"
the user expects the string to be displayed as "ID-12&iexcl;" or
"ID-12¡", not "ID-12!" (where the "!" actually represents an
inverted exclamation point).
It is sufficient to quote the '&' here:

User enters: "ID-12&iexcl;"
Inserted into HTML: "ID-12&amp;iexcl;"
Displayed: "ID-12&iexcl;"
We have tried to display the user's string with <PRE>string</PRE>,
<CODE>string</CODE>, <BLOCKQUOTE>string</BLOCKQUOTE> and even the
deprecated <LISTING>string</LISTING> to no avail. Even though our
reference text
Time to look for a correct reference text.
implies that the sequence of characters between <PRE>
and </PRE> will not be interpreted by HTML, both of our browsers (MS
and Netscape) do interpret the characters.


--
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://www.odahoda.de/
Nov 23 '05 #3

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

Similar topics

4
by: hoke | last post by:
I want to display plain text files in the browser. The files contain html and javascript and have a .txt extension. This works fine with files with just html. Unfortunately when showing files with...
4
by: dmiller23462 | last post by:
I'm trying to create a submission page for users to request PC/LAN Access....If they select "Yes" in the field asking about if they need Non Standard Software, I want several other HTML fields to...
14
by: JStrauss | last post by:
Hello, Can anybody give me some tips on the best and/or easiest way to display multiple lines in a field. The data is collected from a "textarea" field when the form is submitted, and I want to...
5
by: Richard | last post by:
I am filling a TEXTAREA with text and links from a database. I need to display the <a href....> code in the TEXTAREA as a clickable link with _blank targetting. I realise I could simply use a TD...
19
by: dmiller23462 | last post by:
Hi guys....I have absolutely NO IDEA what I'm doing with Javascript but my end result is I need two text boxes to stay hidden until a particular option is selected....I've cobbled together the...
2
by: groups | last post by:
Hello, HTML-heads. Odd problem that I haven't encountered before. This form and/or textarea is appearing to have no columns or no width to the end user. This only happens to the user on one...
6
by: tony wong | last post by:
i wish to count number of characters in textarea box during typing in and display it somewhere in html page. so the number will increase during writing. is it possible to do it by javascript? ...
3
by: Erwin Moller | last post by:
Hi all, Situation: A (rather long) page that contains a lot of divs. Some are visible (display:inline) at a certain time, other not. The javascript is responsible for divs to be visible or...
3
by: jiayanxiang | last post by:
Is there any sample code to use Javascript to load and display a text file? It will be best if the user can select files using some kind of explorer. If that's complex, a text box to specify the...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.