我为strip <script> </ script>标签创建此表单,但此表单不起作用

use*_*077 2 html javascript php asp.net

我为条带<script></script>标签创建此表单,但此表单不起作用请任何人修改此表单以开始工作

<html>
<head>
<script language='javascript'>
  function alfa(s) {
    return s.replace(/<script>[^<\/script>]*<\/script>/g, "");
  }
</script>
</head>
<body>
<form>
<textarea name="txt" style="width: 300px; height: 150px"></textarea><br />
<input type="button" value="Remove script tags" onClick="txt.value=alfa (txt.value)">
</form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

dur*_*uri 5

return s.replace(/<script>[\s\S]*?<\/script>/g, "");
Run Code Online (Sandbox Code Playgroud)

[\s\S]表示"任何字符"(Javascript中的点不匹配\n),问号使*"懒惰".使用[^ ]只针对单个字符的否定. [^<\/script>]表示"除<,/,s,c,r,i,p,t或>之外的任何字符".