Как я могу встроить текстовую область в другой текстовой области в HTML?

Здесь есть несколько замечательных предложений, но я бы также предложил точно названное Hacker News . У них вообще есть много отличных статей по программированию.

10
задан John Scipione 28 October 2009 в 17:23
поделиться

6 ответов

Yo dawg.

Seriously, encoding the html is the only option. You can always decode it/do whatever in your server-side code once it gets posted.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <title>Test Embedded textareas</title>
</head>
<body>
    <form method="POST">
        <textarea>
            Outside Textarea
            &lt;textarea&gt;Inside Textarea&lt;/textarea&gt;
        </textarea>
        <input type="submit" value="Submit" />
    </form>
</body>
</html>
23
ответ дан 3 December 2019 в 15:06
поделиться

No. You can't do it. The only thing valid inside of a textarea is text. It's a textarea. :-)

2
ответ дан 3 December 2019 в 15:06
поделиться

Попробуйте это:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <title>Test Embedded textareas</title>
</head>
<body>
    <textarea>
        Outside Textarea

    </textarea>
<textarea style="margin-top:-250px; height:250px;">Inside Textarea</textarea>
</body>
</html>
1
ответ дан 3 December 2019 в 15:06
поделиться

Why?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <title>Test Embedded textareas</title>
</head>

<style type="text/css">
    #outside { position:absolute; top:0; left:0; z-index:0; width:400px;
        height:400px }
    #inside  { position:absolute; top:100px; left:100px; z-index:1; 
        width:200px; height:200px; }
</style>

<body>

    <div>

        <textarea id="outside" rows="10" cols="80">
            Outside Textarea
        </textarea>

        <textarea id="inside" rows="5" cols="60" readonly>
            Inside Textarea
        </textarea>

    </div>

</body>
</html>
0
ответ дан 3 December 2019 в 15:06
поделиться

Try a hidden form field.

0
ответ дан 3 December 2019 в 15:06
поделиться

Рассматривали ли вы возможность использования FckEditor ?

0
ответ дан 3 December 2019 в 15:06
поделиться
Другие вопросы по тегам:

Похожие вопросы: