HTML, js to achieve text horizontal scrolling (marquee) effect

<!DOCTYPE HTML>
<html>
<head>
<meta charset=UTF-8 />
<title>横向滚动</title>


<script>
    var test1 = function (x, y, text)
    {
    // eleId is the variable name defined by itself, arbitrarily selected
    // document.createElement ('marquee'); 勿改变
        var eleId = document.createElement ('marquee');
        eleId.style.position = 'absolute';
        eleId.style.left = x + 'px';
        eleId.style.top = y + 'px';
        eleId.innerText = text;
        document.body.appendChild (eleId);
    }
     
    window.onload = function ()
    {
    var abc = "The power will be cut off on Monday, Wednesday, and Friday, and the water will be cut off on Tuesday, Thursday, and Saturday. Please tell the owners to each other";
        test1 (150, 100, abc);
        <!-- (x-axis, y-axis)(150,100) - ->
    }
</script>
</head>
<body>
</body>
</html>

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325607914&siteId=291194637