回车和换行 - JavaScript / HTML

时间:2016-04-14 17:36:54

标签: javascript html

所以我试图将一些文本从表单保存到一个小窗口,所以我可以复制它并保存(如果需要的话)。

以下是表格:

<form method="post" action="index2.php?page=internet&amp;var2=243.12.1.213&amp;var3=log&amp;var4=">
<textarea class="form" id="editlog" name="editlog" rows="20" cols="100">14-04-2016 16:01 [localhost] logged in to [243.12.1.213]
14-04-2016 15:44 admin logged in from [localhost]
14-04-2016 15:44 admin logged in from [localhost]
14-04-2016 05:56 [localhost] logged in to [243.12.1.213]
14-04-2016 04:35 [localhost] logged in to [243.12.1.213]
14-04-2016 04:32 [localhost] logged in to [243.12.1.213]
14-04-2016 03:45 admin logged in from [localhost]
14-04-2016 03:40 admin logged in from [localhost]
09-04-2016 22:55 admin logged in from [localhost]
15-05-2015 19:12 admin logged in from [localhost]
18-02-2015 22:13 admin logged in from [localhost]
</textarea>
<input name="simpleantibot" value="1" type="hidden"><br>
<input value="Edit log" class="form" type="submit">
<input class="form" value="Revert log" onclick="window.location='index2.php?page=internet&amp;var2=243.12.1.213&amp;var3=log&amp;var4=&amp;revert'" type="button"></form>

我想要做的是从

中获取文字
<textarea> 

并将其复制到新窗口,清除文本然后提交表单。

唯一的问题是,当新窗口打开时,文本似乎丢失了所有回车符/新行。但是当我检查HTML时,它们都在那里(回车/换行)...所以我猜它是HTML,但我不确定,这是我的JavaScript:

http://pastebin.com/uXU6zZdJ(他们说我的代码太多了?)

无论如何都要提前感谢,如果你在JavaScript中看到任何内容让我知道我刚刚开始学习,任何提示都将不胜感激!

0 个答案:

没有答案