<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $("#replace").click(function () {
                $("br").replaceWith("<hr/>"); //将所有br替换为hr

                $("p").wrap("<font color='red'></font>"); //用红色样式将p标签给包起来

                //<font color='red'> <p> 用特定的样式包起来</p></font>
            });
        })
    </script>
</head>
<body>
    sdfsdfsdfrgrefg<br />
    sdfsdfsdfrgrefg<br />
    sdfsdfsdfrgrefg<br />
    sdfsdfsdfrgrefg<br />
    sdfsdfsdfrgrefg<br />
    sdfsdfsdfrgrefg<br />
    <p>
        用特定的样式包起来</p>
    <p>
        用特定的样式包起来</p>
    <p>
        用特定的样式包起来</p>
    <p>
        用特定的样式包起来</p>
    <input type="button" value="ReplaceWith" id="replace" />
</body>
</html>

 

相关文章:

  • 2022-12-23
  • 2022-01-19
  • 2021-10-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-06
  • 2021-11-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-17
  • 2021-06-24
相关资源
相似解决方案