<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>异步变同步</title>
</head>
<body>
    <script type="text/javascript">
        var a = 0;
        window.onload = function(){
            var a = function(){
                setTimeout(function(){
                    a = 100;
                    if(get){
                        get(a)
                    }
                },5000)
            }()

            if(a){
                document.write(a)
            }else if(!a){
                var get = function(b){
                    a=b;
                    document.write(a)
                }
            }
        }
        
    </script>
</body>
</html>

 

相关文章:

  • 2021-06-16
  • 2022-12-23
  • 2022-12-23
  • 2021-09-22
  • 2021-07-09
猜你喜欢
  • 2022-12-23
  • 2021-07-24
  • 2022-12-23
  • 2022-01-08
  • 2021-07-06
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案