HTML----------字符串代码

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>童心少年</title>
  </head>
  <body>    
    <script>
        var x="12345";
        var y="上山打老虎";
        var z="translate";
        var a="TTTT";
        var b="   nb fw";
        document.write(x.charAt(1)+"<br>");
        document.write(y.charCodeAt(1)+"<br>");
        document.write(x.concat(y)+"<br>");
        document.write(String.fromCharCode(65)+"<br>");
        document.write(y.indexOf("")+"<br>");
        document.write(x.localeCompare(y)+"<br>");
        document.write(y.match("")+"<br>")
        document.write(z.replace("a","s")+"<br>");
        document.write(y.search("")+"<br>");
        document.write(x.slice(2)+"<br>");
        document.write(x.split(3)+"<br>");
        document.write(y.substr(2)+"<br>");
        document.write(y.substring(1,3)+"<br>");
        document.write(a.toLocaleLowerCase()+"<br>");
        document.write(z.toLocaleUpperCase()+"<br>");
        document.write(a.toLowerCase()+"<br>");
        document.write(z.toString()+"<br>");
        document.write(z.toUpperCase()+"<br>");
        document.write(b.trim()+"<br>");
        document.write(x.valueOf()+"<br>");
        </script>
      
  </body>
</html>

 

posted @ 2025-11-23 09:45  付书恒  阅读(0)  评论(0)    收藏  举报