input fields and strings

T

Tim Fooy

Hi all,

I hope there is a simple solution to this rather trivial problem i can't
find a solution for.

Because it's better not to write characters like & and é directly into HTML
source, i wrote them as the named escape codes & and é The
strings in which they occur are written as javascript strings. Later i have
to copy these strings into HTML input text fields. There, they are shown
literaly, so you see & instead of just &.

In actual code:
<script type="text/javascript">
ar[1] = "one &amp; two";
document.form.inputtext.value = ar[1];
</script>

shows the string "one &amp; two" rather than "one & two" in the input field.

Is there a way to make the input field show the actual (interpreted) string
instead of just all the characters that are in the javascript string?

TIA,

regs,
Tim
 
T

Tim Fooy

Yes, but the &amp; is written by another application out of my control. So
I must reach some kind of interpretation of these escape codes when put in
an input field.

Black Rose said:
The & is good for JavaScript.



Hi all,

I hope there is a simple solution to this rather trivial problem i can't
find a solution for.

Because it's better not to write characters like & and é directly into HTML
source, i wrote them as the named escape codes &amp; and &eacute; The
strings in which they occur are written as javascript strings. Later i have
to copy these strings into HTML input text fields. There, they are shown
literaly, so you see &amp; instead of just &.

In actual code:
<script type="text/javascript">
ar[1] = "one &amp; two";
document.form.inputtext.value = ar[1];
</script>

shows the string "one &amp; two" rather than "one & two" in the input field.

Is there a way to make the input field show the actual (interpreted) string
instead of just all the characters that are in the javascript string?

TIA,

regs,
Tim
 

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

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top