473,320 Members | 2,024 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

List <a> tags in a textarea

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...

Please reply to

just1coder -at- yahoo -dot- ca
Jul 23 '05 #1
4 1257
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.
Please reply to

just1coder -at- yahoo -dot- ca


No thanks. Ask in News, get answered in News.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/
Jul 23 '05 #2
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.
Please reply to

just1coder -at- yahoo -dot- ca


No thanks. Ask in News, get answered in News.


I was looking for an example.
Jul 23 '05 #3
ju********@yahoo.ca (just1coder) writes:
> 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...

How? Should the option's value/text be '<a name="this">this</a>' or
should it be 'this'?

.... I was looking for an example.

---
var text = document.getElementById("textAreaId").value;
var select = document.getElementById("selectId");
var lines = text.split("\n");
for (var i in lines) {
if (lines[i]!="") {
select.options[select.options.length]=new Option(lines[i]);
}
}
---
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #4
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/
Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Augustus | last post by:
Hiya, I have a form with a <textarea></textarea> to receive user input. This input is then stored in a database and sent by fax... I need to be able to remove the carriage returns (enter...
2
by: Eshrath | last post by:
Hi, What I am trying to do: ======================= I need to form a table in html using the xsl but the table that is formed is quite long and cannot be viewed in our application. So we are...
2
by: Donald Firesmith | last post by:
I am having trouble having Google Adsense code stored in XSL converted properly into HTML. The <> unfortunately become &lt; and &gt; and then no longer work. XSL code is: <script...
17
by: Albert Wagner | last post by:
I have a page with two frames. Frame1 contains an inline script. Frame2 contains inline and 2 loaded scripts. How may I call a function in frame1(inline) from frame2(inline or loaded)? Albert
2
by: Tom Vogel | last post by:
I'd like to use the XML Documentation Tags to comment my C# code. But many of the tags do not have any effect when I execute the "Build Comment Web Pages" menu. For example, the <list> tag gets...
4
by: matty.hall | last post by:
I have two classes: a base class (BaseClass) and a class deriving from it (DerivedClass). I have a List<DerivedClass> that for various reasons needs to be of that type, and not a List<BaseClass>....
8
by: ASP Yaboh | last post by:
I have an ArrayList of data gathered from a database. I want to create a web page from this data by creating a <table>, each cell in each row displays the appropriate data. One of those cells in...
7
by: Andrew Robinson | last post by:
I have a method that needs to return either a Dictionary<k,vor a List<v> depending on input parameters and options to the method. 1. Is there any way to convert from a dictionary to a list...
3
by: ajay2552 | last post by:
Hi, I have a query. All html tags start with < and end with >. Suppose i want to display either '<' or '>' or say some text like '<Company>' in html how do i do it? One method is to use &lt,...
14
by: Michael | last post by:
Since the include function is called from within a PHP script, why does the included file have to identify itself as a PHP again by enclosing its code in <?php... <?> One would assume that the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.