1 Replies - 365 Views - Last Post: 24 February 2009 - 11:55 AM

#1 Terryox  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 24-February 09

Changing values input in a text box

Post icon  Posted 24 February 2009 - 11:37 AM

I'm a beginner with this stuff, so I'm not sure what sort of code I should use.

Basically I want users to put in words and every time "x" letter goes in, I want it to turn into "y" when they hit a button.

I think arrays would be a good way to go, but I'm not quite sure how I'm going to make it translate S:

Any tips?
Is This A Good Question/Topic? 0
  • +

Replies To: Changing values input in a text box

#2 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1641
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Changing values input in a text box

Posted 24 February 2009 - 11:55 AM

I would suggest using a Global Regular Expression with the replace() Methodfunction. Here's an example that takes a string, what to search for and what to replace it with

function replaceAll(str,searchFor, replaceWith)
{
	return str.replace(/searchFor/g,replaceWith);
}


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1