• 网页文本编辑器


    1. DOCTYPE html>
    2. <html>
    3. <head>
    4. <meta charset="utf-8">
    5. <title>文本编辑器title>
    6. <style>
    7. .box {
    8. height: 500px;
    9. width: 1000px;
    10. margin: auto;
    11. background-color: navajowhite;
    12. }
    13. .box_h {
    14. /* font-weight: normal; */
    15. text-align: center;
    16. height: 40px;
    17. width: 200px;
    18. margin: auto;
    19. padding: auto;
    20. font-family: "楷体";
    21. font-size: 30px;
    22. }
    23. #txta {
    24. height: 490px;
    25. width: 996px;
    26. border-radius: 0px;
    27. outline: none;
    28. border-inline: none;
    29. background-color: blanchedalmond;
    30. resize: none;
    31. font-size: 20px;
    32. }
    33. select {
    34. height: 20px;
    35. margin-left: 200px;
    36. }
    37. style>
    38. head>
    39. <body>
    40. <div class="box">
    41. <h2 class="box_h">文本编辑器h2>
    42. <select id="s1" onchange="changeFontcolor()">
    43. <option>字体颜色option>
    44. <option value="red">红色option>
    45. <option value="black">黑色option>
    46. <option value="blue">蓝色option>
    47. select>
    48. <select id="s2" onchange="changeFontsize()">
    49. <option>字体大小option>
    50. <option value=" 100px">option>
    51. <option value="50px">option>
    52. <option value="20px">option>
    53. select>
    54. <select id="s3" onchange="changeFontfamily()">
    55. <option>字体option>
    56. <option value=" 宋体">宋体option>
    57. <option value="楷体">楷体option>
    58. <option value="黑体">黑体option>
    59. select>
    60. <textarea id="txta">textarea>
    61. div>
    62. <script>
    63. function changeFontcolor() {
    64. var color = document.getElementById("s1");
    65. var textarea = document.getElementById("txta");
    66. textarea.style.color = color.value;
    67. }
    68. function changeFontsize() {
    69. var size = document.getElementById("s2");
    70. var textarea = document.getElementById("txta");
    71. textarea.style.fontSize = size.value;
    72. }
    73. function changeFontfamily() {
    74. var family = document.getElementById("s3");
    75. var textarea = document.getElementById("txta");
    76. textarea.style.fontFamily = family.value;
    77. }
    78. script>
    79. body>
    80. html>

     

  • 相关阅读:
    【小白笔记】pikachu之文件包含漏洞
    python selenium参数详解和案例实现
    虚拟电厂可视化大屏,深挖痛点精准减碳
    数据分表Mybatis Plus动态表名最优方案的探索
    docker 部署 RabbitMQ
    CanvasScaler计算方法
    go语言数组、切片和指针
    Redis 全景图(3)--- Redis 应用于缓存
    pm2 命令手册
    自定义View6 -塔防小游戏:第三篇防御塔随意放置+多组野怪
  • 原文地址:https://blog.csdn.net/m0_71385141/article/details/133247840