html替换指定字符串
- var ca = "123Tabc456"; // 获取数据
- var ca2 = ca.replace("T", " "); // 替换指定字符串
- document.getElementById("createdAt").textContent = "生成时间 : " + ca2 || '-'; // 判断是否有数据,没有则显示-
- <html>
- <head>
- <meta charset="UTF-8">
- <title>图形验证码</title>
- </head>
-
- <style>
- div {
- width: min-content;
- background: #0063DF33;
- color: #0063DD;
- }
- </style>
-
- <body>
-
- <input id="btnSendCode" type="button" value="点击" onClick="sendgo()" />
- <div id="createdAt">111</div>
-
- </body>
-
- <script type="text/javascript">
- function sendgo() {
- console.log('000 000 000', "点击");
- /
-
- var ca = "123Tabc456"; // 获取数据
- var ca2 = ca.replace("T", " "); // 替换指定字符串
- document.getElementById("createdAt").textContent = "生成时间 : " + ca2 || '-'; // 判断是否有数据,没有则显示-
-
- /
- console.log('111 333 666', "点击");
- }
- </script>
-
- </html>