...

View Full Version : Need help with code



Bogies girl
12-06-2009, 07:12 PM
Ok I have look all over and cannot find out how to do this. I have found how to covert first letter of a word to capitalization, but not just the LAST letter. Such as bogieS. Is this not at all possible? Am I driving myself insane for no reason? This is what I have and it isn't near right.


function capitalizeMe(obj) {
val = obj.value;
newVal = '';
val = val.split(' ');
for(var c=0; c < val.length; c++) {
newVal += val[c].substring(0,1).toLowerCase(0,-1) +
val[c].substring(0,val[c].length) + ' ';
newVal += val[c].substring().toUpperCase(0) +
val[c].substring(0,val[c].length) + ' ';

}
obj.value = newVal;

}

ww.yashika.info
12-07-2009, 11:04 AM
Pls check whether the following satisfies your need...:)

<script language="JavaScript">
function makeMeUpper(myname)
{
var name_len = myname.length;

var last_char =myname.charAt(name_len-1);
last_char =last_char.toUpperCase();

myname = myname.substring(0,name_len-1);
myname = myname+last_char;
return myname;
}

alert(makeMeUpper('Hello'));

</script>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum