rculver
03-13-2003, 12:29 PM
I have element names that start with OpenClose such as OpenClose1, OpenClose2, OpenClose3, etc. I want to get the number after OpenClose and use it. How do I do it?
|
Click to See Complete Forum and Search --> : Getting a piece of an element name rculver 03-13-2003, 12:29 PM I have element names that start with OpenClose such as OpenClose1, OpenClose2, OpenClose3, etc. I want to get the number after OpenClose and use it. How do I do it? AdamBrill 03-13-2003, 12:38 PM Lets say that element is the reference to the element. Then you would go like this: num = element.name.substring(9,element.name.length); Then num has whatever is after the OpenClose... :) Sergey Smirnov 03-13-2003, 12:49 PM Adding parseInt function will be a good idea. Otherwise, 'num' is still a string, not a number. I.e. num = parseInt(element.name.substring(9)); rculver 03-13-2003, 01:32 PM Thanks for your help. webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |