⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 badwordsexample.htm

📁 这是javascript高级程序设计的源码
💻 HTM
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
    <head>
        <title>Bad Words Example</title>
        <script type="text/javascript">
               
                function filterText(sText) {
                    var reBadWords = /badword|anotherbadword/gi;
                    return sText.replace(reBadWords, "****");            
                }
                
                function showText() {
                    var oInput1 = document.getElementById("txt1");
                    var oInput2 = document.getElementById("txt2");
                    oInput2.value = filterText(oInput1.value);
                }
        </script>
    </head>
    <body>
        <p>Enter some text below including "badword" and "anotherbadword", and click the button<br />
        <textarea rows="10" cols="50" id="txt1"></textarea><br />
        <input type="button" value="Filter Bad Words" onclick="showText()" /></p>
        <p>Filtered Text:<br />
        <textarea rows="10" cols="50" id="txt2"></textarea></p>
        
    </body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -