Simple question about codes, please help.

S

Sender

HI folks. I was wondering. In using forms with javascript, I noticed that
you can create a new line in a multiline text box using the escape code
'\r'. Does anyone know where I could find a list of all of these such codes?

Also, is it possible to change the font or other attributes of the text in
the form boxes?

TIA
Bill
 
L

Lasse Reichstein Nielsen

Sender said:
HI folks. I was wondering. In using forms with javascript, I noticed that
you can create a new line in a multiline text box using the escape code
'\r'. Does anyone know where I could find a list of all of these such codes?

\r inside a Javascript string literal represents the character with
ASCII number 13 - Carrige Return. You should probably have used \n (ASCII 10,
Newline).

The list of all of the possible single-character escape sequences is
in the ECMAScript standard, section 7.8.4 (String Literals). I copied
it here:
---
Escape Sequence Code Point Value Name Symbol
\b \u0008 backspace <BS>
\t \u0009 horizontal tab <HT>
\n \u000A line feed (new line) <LF>
\v \u000B vertical tab <VT>
\f \u000C form feed <FF>
\r \u000D carriage return <CR>
\" \u0022 double quote "
\' \u0027 single quote '
\\ \u005C backslash \
---
The "Code Point" is the corresponding value of the character in the
Unicode encoding, also written as a string escale (backslash - u -
four hex digits).
Also, is it possible to change the font or other attributes of the text in
the form boxes?

That is browser dependent. You can try using CSS.
<style type="text/css">
textarea {font-family: sans-serif;color:red;}
</style>

/L
 
D

David Dorward

David said:
Since when did JavaScript triggered native dialog boxes support CSS?

OK, the comment actually makes sense when taken in context of the second
(unrelated to the subject) part of the original comment.

This is why its useful to _quote_ relevent material when responding on
Usenet.
 
M

Michael Winter

David Dorward wrote on 21 Dec 2003 at Sun, 21 Dec 2003 16:45:21 GMT:
Since when did JavaScript triggered native dialog boxes support CSS?

Unless I missed something, the OP is asking about form controls, not
dialog boxes.

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,266
Latest member
DavidaAlla

Latest Threads

Top