5 课程区块链全栈开发-以太坊DAPP开发实战练习中web3导入不了

代码:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!DOCTYPE html>
<html>
<head>
    <title>First DApp Demo</title>
    <link rel="stylesheet" type="text/css" href="main.css">
    <script src="https://cdn.jsdelivr.net/npm/web3@latest/dist/web3.min.js"></script> <!-- 引入web3 -->
</head>
<body>
    <div class="container">
        <h1>First DApp Demo</h1>
        <h2 id="info"> </h2>
        <label>姓名:</label>
        <input id="name" type="text" name="">
        <label>年龄:</label>
        <input id="age" type="text" name="">
        <button id="button">更新内容</button>
    </div>

    <script>

        console.log("web3:" + web3);

    </script> 

</body>
</html>

报错: Uncaught ReferenceError: web3 is not defined at index.html:23

请先 登录 后评论

3 个回答

Tiny熊 - 布道者
  擅长:智能合约,以太坊
请先 登录 后评论
心灰意冷
请先 登录 后评论
Clmss
请先 登录 后评论