View Full Version : Setting max length
06-14-2007, 05:00 AM
I have a var called str ( var str= ) , which is later defined by several propertys .. how do I more/less go ... if str is longer than 298 charicters , shorten it down to make sure it is no longer than 298 charicters.
06-14-2007, 05:11 AM
Isnt' it you already have that in this thread (http://www.codingforums.com/showthread.php?t=116265)?
06-14-2007, 05:13 AM
no .. that is checking browser type to run that function .. this is how to run the function instead .. but i dont think i did it right because the function isnt running right.
06-14-2007, 05:18 AM
I'm not saying the browser type checking but this:
if(st.length > 2083) st = st.substr(0, 2083);
If you want to set str the maximum length of 298, then you'd do the same thing.
if(str.length > 298) str = str.substr(0, 298);
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.