python(html day15s18)

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <div id="i1">Sooele</div>

    <script>
        function func(){
            // 根据ID获取指定标签的内容,定于局部变量接受
            var tag = document.getElementById('i1');
            // 获取标签内部的内容
            var content = tag.innerText;

            var f = content.charAt(0);
            var l = content.substring(1,content.length);

            var new_content = l + f;

            tag.innerText = new_content;
        }
        setInterval('func()', 500);
    </script>
</body>
</html>

发表评论