Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Senior Coder crmpicco's Avatar
    Join Date
    Jan 2005
    Location
    Mauchline, Scotland
    Posts
    1,096
    Thanks
    15
    Thanked 1 Time in 1 Post

    Exclamation array value to propercase

    Code:
    // Function to change any text to Proper Case (e.g. picco -> Picco)
    String.prototype.toProperCase = function() 
    {
    	return this.charAt(0).toUpperCase() + this.substring(1,this.length).toLowerCase();
    }
    
    function functioname()
    ......
    ..
    
    	div = document.getElementById('demodiv')
    	div.innerHTML='<table border=1>'
    	div.innerHTML=div.innerHTML+'<tr><td>FARE RULES<br></td></tr>'
    
    	for (u=1;u<=counter;u++)
    	{
    		div.innerHTML=div.innerHTML+'<tr>'
    		div.innerHTML=div.innerHTML+'<td>'
    		div.innerHTML=div.innerHTML+headingArr[u]+'&nbsp;&nbsp;&nbsp;&nbsp;'
    		div.innerHTML=div.innerHTML+'</td>'
    		div.innerHTML=div.innerHTML+'<td>'
    		div.innerHTML=div.innerHTML+contentArr[u]+'&nbsp;&nbsp;&nbsp;&nbsp;<br>'
    		div.innerHTML=div.innerHTML+'</td>'
    		div.innerHTML=div.innerHTML+'</tr>'
    	}
    		bTableSetup = true;
    		div.innerHTML=div.innerHTML+'</table>'
    ...
    ....
    how can i change the value of headingArr[u] to be Proper case, ie. Picco instead of picco

  • #2
    Senior Coder crmpicco's Avatar
    Join Date
    Jan 2005
    Location
    Mauchline, Scotland
    Posts
    1,096
    Thanks
    15
    Thanked 1 Time in 1 Post

    Exclamation

    cell = row.insertCell()
    cell.innerHTML = headingArr[a].toProperCase()
    cell2 = row.insertCell()
    cell2.innerHTML = contentArr[a].toProperCase()


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •