This is a discussion on find words and change within the JavaScript Programming forums, part of the Programming & Scripting category; Hi, If someone enters High School in a text box i want to make it H.S. If someone enters university ...
| |||||||
|
#1
| |||
| |||
| Hi, If someone enters High School in a text box i want to make it H.S. If someone enters university in a textbox I want to make it Unv I tried the replace function in javascript but i think i messed it up somewhere Any idea todd |
|
#3
| ||||
| ||||
| for one, post your code. for two, what if they type in Univ ... or College or etc. well, hopefully you get what i'm getting at. why not use a drop down box so that they will always be what you want them to be.
__________________ Quote of the Month: Mistakes: It could be that the purpose of your life is only to serve as a warning to others. Questions to Ponder: Why do banks charge you a "non-sufficient funds fee" on money they already know you don't have? iif([sarcasm]=true,iif([you have to ask]=true,"didn't work","ha ha ha"),"not sarcasm") copyright © 2008 sbenj69 Sarchasm: The gulf between the author of sarcastic wit and the person who doesn't get it. |
|
#4
| |||
| |||
| hi, this is the code i have Code: if (getinstnamemem.length > 0)
{
getinstnamemem=getinstnamemem.replace("High School", "H.S.");
getinstnamemem=getinstnamemem.replace("University", "Unv");
}
but if someone enters university it doesnt change it to Unv can someone tell me how i can make it happen todd |
|
#5
| ||||
| ||||
| There is really no good way to do what you are trying to do. The number of permutations are almost infinite, even if you upper or lower case the string prior to doing the replace: High School High School High School University Univ. Univ are all different.
__________________ Wolffy ------------------------ Opinions expressed are my own and do not necessity reflect those of any sane person. Any code provided is intended to be an example and is provided AS IS. Rework for your specific environment may be required. Void where prohibited by law. Not valid in California. Your mileage may vary. |
![]() |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Change to Reputation System | jmurrayhead | Announcements | 0 | June 2nd, 2008 09:57 PM |