Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Preserving Symbols in Text Box

Status
Not open for further replies.

tempoman

Programmer
May 9, 2000
41
0
0
AU
Could someone please help on my javascript.

I have a page that allows someone to enter the contents of a box into a text box. The complicated thing is that it allows people to enter the greek symbols alpha, beta and gamma, which can appear anywhere in the text. I currently have 3 submit boxes, so when someone press the box for alpha it will be added to the end of the list for the symbol for alpha.

It works fine until the contents already has a a symbol in it. My question is how do I make it so it doesn't reformat the existing text.

Here some of my code for alpha:

function PriceUpdate(num, contents)
{
var fcontent = contents;

alert (fcontent);
document.update.contents.value += ' á';


}

<input type=&quot;button&quot; name=&quot;alpha&quot; onclick=&quot;javascript:priceUpdate(1, document.update.contents.value)&quot; value=&quot;á&quot;>
<FONT face=Verdana size=&quot;2&quot;>
Contents: <br>
<input name=&quot;contents&quot; type=&quot;text&quot; size=&quot;50&quot; value=&quot;#Contents#&quot;><br>
</font>

 
Hi,

I tried your code above but I didn't found any problems with that.... could you post your whole code for evaluation 'coz I didn't experience your problem in my computer... I tried to simulate it by placing symbols in contents and when I click the button for alpha, the symbol was added in the contents....it doesn't reformat the existing text and I even submit it using asp but still I receive the same symbols.

Regards,
 
My problem occurs when I already have a greek symbol already from a database. When I try to add another greek symbol to the existing data, it gives me | in place of the old symbol.

The problem occurs when I am passing the contents of the text box to the function, how do I preserve it so that when I add the new greek symbol the existing text stays exactly the same? Is there a function not &quot;eval&quot; that perserves and doesn't change the format.


Here is my code again:

function PriceUpdate(num, contents)
{
var fcontent = contents;

alert (fcontent);
document.update.contents.value += ' á';


}

<input type=&quot;button&quot; name=&quot;alpha&quot; onclick=&quot;javascript:priceUpdate(1, document.update.contents.value)&quot; value=&quot;á&quot;>
<FONT face=Verdana size=&quot;2&quot;>
Contents: <br>
<input name=&quot;contents&quot; type=&quot;text&quot; size=&quot;50&quot; value=&quot;#Contents#&quot;><br>
</font>

Thanx

Richard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top