问答详情
源自:8-17 编程练习

我这样不可以吗

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8" />

<meta name="viewport" content="width=device-width, initial-scale=1">

<title></title>

</head>

<span id="r">5</span>

<body>

<script type="text/javascript">

var i =document.getElementById("r");

setTimeout(i.innerHTML="4",3000);

</script>

</body>

</html>


提问者:qq_慕虎8015442 2019-12-05 14:56

个回答

  • 晓之蛇
    2019-12-05 15:31:57

    代码外加双引号

        var i = document.getElementById("r");    
        setTimeout("i.innerHTML = 4", 3000);