如何生成抖音的斜体加粗英文昵称(附源码)

一、先导条件

1、你要有一台电脑或者手机
2、你会复制、粘贴,以及修改文件后缀名

二、功能展示

在这里插入图片描述

三、操作步骤

1、新建一个文本文件;
在这里插入图片描述
2、打开“新建文本文档.txt”,然后将源代码复制到编辑框并保存;
在这里插入图片描述
3、修改“新建文本文档.txt”为“新建文本文档.html”;
在这里插入图片描述
4、双击“新建文本文档.html”,选择任意浏览器打开,出现下图界面;
在这里插入图片描述
5、在第一个白色框中输入昵称,再店家“点击生成”即可。

四、源代码


<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>抖音斜体字 - www.x6d.com/www.x6k.com</title>
  <style>
    body{
      background-color: #7952b3;
      padding: 0px;
      margin: 20px;
      margin-bottom: 10px;
    }
    .youname{
      width: 100%;
      height: 37px;
      border: none;
      box-shadow: 1px 1px 3px #584d69;
      border-radius: 2px;
      margin-bottom: 20px;
      margin-top: 20px;
      outline: none;
      padding-left: 10px;
      box-sizing: border-box;
      line-height: 37px;
      font-size: 16px;
    }
    .apptitle{
      font-size: 24px;
      color: #ffffff;
      font-weight: bold;
      text-shadow: 2px 2px 2px #fd2a2a;
      font-style: italic;
    }
    button{
      padding: .75rem;
      background-image: linear-gradient(to bottom right,rgba(255,255,255,.2),rgba(255,255,255,.01));
      box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,.1);
      background-color: #dc3545!important;
      border: none;
      width: 100%;
      color: #ffffff;
      border-radius: 2px;
      outline: none;
    }
    .result{
      width: 100%;
      height: 80px;
      border: none;
      box-shadow: 1px 1px 3px #584d69;
      border-radius: 2px;
      outline: none;
      box-sizing: border-box;
      background-color: #ffffff;
      margin-bottom: 10px;
      display: flex;
      justify-content: center;
      align-items: center;
      font-weight: bold;
      font-size: 24px;
    }
  </style>
</head>
<body>
  <div class="apptitle">抖音斜体字生成</div>
  <div class="doc">
    <input value="Kun" placeholder="请输入昵称" id="youname" class="youname" >
    <div class="result" id="result"></div>
    <button onclick="ok()">点击生成</button>
  </div>
  <script>
    const baseText = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
    const LowerCase = ['𝘼','𝘽','𝘾','𝘿','𝙀','𝙁','𝙂','𝙃','𝙄','𝙅','𝙆','𝙇','𝙈','𝙉','𝙊','𝙋','𝙌','𝙍','𝙎','𝙏','𝙐','𝙑','𝙒','𝙓','𝙔','𝙕']
    const UpperCase = ['𝙖','𝙗','𝙘','𝙙','𝙚','𝙛','𝙜','𝙝','𝙞','𝙜','𝙠','𝙡','𝙢','𝙣','𝙤','𝙥','𝙦','𝙧','𝙨','𝙩','𝙪','𝙫','𝙬','𝙨','𝙮','𝙯']
    function ok() {
      var input = document.getElementById('youname')
      var result = ''
      for (var i of input.value) {
        if (/[A-Za-z]/.test(i)) {
          var index = baseText.indexOf(i.toLocaleUpperCase())
          if (/[a-z]/.test(i)) {
            result += UpperCase [index]
          } else {
            result += LowerCase[index]
          }
        } else {
          result += i
        }
      }
      document.getElementById('result').innerText = result
    }
  </script>
</body>
</html>

五、如果嫌麻烦的话,可以下载下述附件

点击下载附件

  • 3
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值