广告合作
  • 今日头条

    今日头条

  • 百度一下

    百度一下,你就知道

  • 新浪网

    新浪网 - 提供新闻线索,重大新闻爆料

  • 搜狐

    搜狐

  • 豆瓣

    豆瓣

  • 百度贴吧

    百度贴吧——全球领先的中文社区

  • 首页 尚未审核订阅工具 订阅

    网页undefined怎么解决

    来源:网络收集  点击:  时间:2024-02-23
    【导读】:
    网页中出现 undefined 是因为 js 中存在没有定义的变量,而直接使用造成的。工具/原料morechromenotepad++方法/步骤1/4分步阅读

    新建文件 hello.html

    2/4

    !doctype html

    html

    head

    meta charset=utf-8 /

    titlehello/title

    /head

    body

    script

    window.onload = function(){

    alert(v) ;

    }

    /script

    /body

    /html

    3/4

    按住 F12 开启调试模式,会看到 undefined 错误

    4/4

    修改代码

    !doctype html

    html

    head

    meta charset=utf-8 /

    titlehello/title

    /head

    body

    script

    window.onload = function(){

    var v = “必须赋值”;

    alert(v) ;

    }

    /script

    /body

    /html

    注意事项

    undefined 是因为没有初始化值造成的

    使用 F12 开启调试

    本文关键词:

    版权声明:

    1、本文系转载,版权归原作者所有,旨在传递信息,不代表看本站的观点和立场。

    2、本站仅提供信息发布平台,不承担相关法律责任。

    3、若侵犯您的版权或隐私,请联系本站管理员删除。

    4、文章链接:http://www.1haoku.cn/art_113809.html

    相关资讯

    ©2019-2020 http://www.1haoku.cn/ 国ICP备20009186号05-05 11:21:35  耗时:0.027
    0.027s