just1coder wrote:
Randy Webb <hi************@aol.com> wrote in message news:<-b********************@comcast.com>...
just1coder wrote:
Is it possible to create a dropdown list populated by the contents of a textarea?
<textarea>
<a name="this">this</a>
<a name="that">that</a>
</textarea>
Then, the dropdown would have the <a> values as options...
Sure.
I was looking for an example.
Not what you asked, but ok.
Assuming that your textarea will *Always* be formatted in that format,
its simply a matter of getting the name and the text. I think you wanted
href= instead of name= though.
Some hints:
get the .value of the textarea, and then parse it for the name(href) and
the text.
http://msdn.microsoft.com/library/de...jsmthsplit.asp http://msdn.microsoft.com/library/de...astindexof.asp http://msdn.microsoft.com/library/de...mthindexof.asp http://msdn.microsoft.com/library/de...hsubstring.asp
Split the .value of the textarea.
Now, you get the indexOf the ", the last indexOf the ", and the
substring, that will give you the href/name.
Then, you repeat for indexOf >, then the lastIndexOf <, then the
substring will give you the text.
That will give you a pretty good start, some good reading, and some
practice. Post back with your best effort........
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ -
http://jibbering.com/faq/