View Full Version : how to change the length of a string

03-16-2009, 11:48 PM
i have a xml file where i do the following query:


now having the variable "entry_03_title" i would like that javascript do this:

if(entry_03_title.length>30) entry_03_title.length=6

in other words if the title is bigger than 30 chars long make it 6 chars, but this doesn't work.any thoughts?

Old Pedant
03-16-2009, 11:50 PM
if(entry_03_title.length > 30) entry_03_title = entry_03_title.substring(0,6);

Maybe time to download a JavaScript reference manual? There are a few good ones out there.