Forum Moderators: open

Message Too Old, No Replies

javascript string filter

         

gleddy

2:19 am on Oct 27, 2004 (gmt 0)

10+ Year Member



heya,

I am getting url's provided to me dynamically and want to limit the size of them in my html document...

is there a way of limiting a strings length when it is an href and not in a form/text field?

so the url would be:
www.thisiswaytoolongformyboxforittofit.com

and want to change to:
www.thisiswaytolong...

cheers!

RonPK

11:02 am on Oct 28, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The property and methods you may find interesting are:

mystring.length => the length of the string
mystring.substr(start [,length]) (reference [msdn.microsoft.com]) and
mystring.substring(start, end) (reference [msdn.microsoft.com])

I hope this helps.

gleddy

11:53 pm on Oct 28, 2004 (gmt 0)

10+ Year Member



cool!thanks.