Click to See Complete Forum and Search --> : assigning special characters values in javascript


lingra
09-02-2003, 09:45 AM
if I hard code the code in the input statement:

<INPUT TYPE="text" NAME="currsymbol" value="& #8364;" readonly>

it prints the symbol, but when I try to assign the value from a javascript, it shows the code "& #8364;" (space added so the code would show.

In this code the part1 shows the symbol, part2 shows the code:

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<form name="formx">
<input type="text" name="part1" value="& #8364;">
<input type="text" name="part2" >
</form>

<script language=javascript>
document.formx.part2.value="& #8364;";
</script>

</body>
</html>

I need to be able to assign the currency symbol depending on whether it is a pound, euro, dollar, etc.

How do you do this in javascript?

Jona
09-02-2003, 02:15 PM
Would there be anything wrong with just using the $, &euro;, etc. signs in the JavaScript code?

[J]ona

Charles
09-02-2003, 02:51 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<title>Example</title>
<script type="text/javascript">
<!--
onload = function () {document.king.tut.value='\u20ac'}
// -->
</script>
<form action="" name="king">
<div>
<input type="text" name="tut">
</div>
</form>