【发布时间】:2017-11-10 10:51:50
【问题描述】:
我需要您帮忙编写一个 javascript 函数来用文本区域中的其他单词替换特定单词。
我想在 textarea 中查找并替换输入文本上放置的单词之间的空格:
例如:
<html>
<head>
<title>Replace Specific words in textarea</title>
</head>
<body>
<Form name="frm" method="post" id="frm">
<TextArea name="txtArea1" cols="85" rows="10" ID="Textarea1">
While it was clear that forwarding the material was naughty (and the "culprits" had their wrists smacked), there.
This is one of the#main#ways of using link events. If you have not seen rollover images before, they are images
</TextArea><br>
Input keywords: <Input type="text" name="findwords" value="the main ways" id="text1">
<Input type="submit" name="btnSubmit" value="Submit" id="submit">
</form>
</body>
</html>
任何帮助将不胜感激
鲍勃
【问题讨论】:
-
更精确地了解您想要的内容。替换后的结果是什么?
-
将在textarea中找到的输入关键字的空格替换为“#” - 只是关键字的空格:例如:输入文本:“主要方式”
-
考虑到该关键字在 textarea 中的实例...
标签: javascript input replace textarea keyword