另一个有问题的jQuery Quiz答案在W3Schools [英] Another questionable jQuery Quiz answer at W3Schools

查看:110
本文介绍了另一个有问题的jQuery Quiz答案在W3Schools的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在W3Schools网站上有一个jQuery测验发布在这里...



http://www.w3schools.com/quiztest/quiztest.asp?qtest=jQuery



问题#16如下,


在文件加载完成之前,哪个jQuery函数用于防止代码运行? / p>

A。 $(document).load()



B。 $(document).ready()



C。 $(body).onload()


我选择答案A错了。(他们的正式答案是B。 p>

我回答了这个问题,以为我知道如下,


  1. DOM被加载(不一定所有的图像都被加载)


我解释了原来的问题的措辞,文件完成加载,以包含所有内容(包含所有图像)。毕竟,我以为这就是为什么他们称之为document.load。同样为了他们的答案是正确的,你必须得出结论,DOM等同于文件。这似乎不是正确的,为什么称它为文档对象模型(DOM)而不是文档?



尽管W3School声称B是正确的答案,真正的答案是什么?



感谢您的想法。



Sidenote: / strong>在我的其他相关问题中引用我自己的评论...



我实际上在jQuery网站上学到了大部分的jQuery,并在StackOverflow上进行了搜索,当我被卡住时,我主要是在W3School上玩测验,因为我是调查他们的jQuery认证的先决条件,我不认为自己是一个jQuery专家,但是我很容易得到95%(19/20)的测验,看到那个答案中的不正确的措词,我想我会确认我已经怀疑在这里张贴,我对这些认证的看法正在转变。






编辑:



我通知了W3Schools这个线程的存在。






编辑2:



当我回答原始的测验问题时,我正在考虑$(window).load(),因此我的测验答案显然不正确。我相信这个事实没有留下三个选择选项作为正确答案。

解决方案

问题含糊不清。 b

正确答案取决于您对文档的定义。如果是DOM,它将是B.如果是整个页面的资产,它将是 $(window).load(function(){...})



你可以看到,这个测验很棒。


There is a jQuery quiz posted on the W3Schools site here...

http://www.w3schools.com/quiztest/quiztest.asp?qtest=jQuery

Question #16 is as follows,

Which jQuery function is used to prevent code from running, before the document is finished loading?

A. $(document).load()

B. $(document).ready()

C. $(body).onload()

I got it wrong by picking answer A. (their official answer is B.)

I answered it, thinking that I knew the following,

  1. document.load fires after everything on the page loads including all images

  2. document.ready fires only after the DOM is loaded (not necessarily all the images have been loaded)

I interpreted the original question's wording of, "document is finished loading", to include everything (with all the images). After all, I thought that's why they called it "document.load". Also for their answer to be correct, you'd have to conclude that "DOM" is the equivalent to "document". This does not seem right otherwise why call it "document object model" (DOM) instead of just "document"?

Despite the W3School claim that B is the correct answer, what is really the correct answer?

Thank-you for your thoughts.

Sidenote: Quoting my own comments in my other related question...

"I actually learn most of my jQuery over at the jQuery site and come search here at StackOverflow when I get stuck. I was mostly playing around with the quiz at W3School because I was investigating their "prerequisites" for jQuery Certification. I don't consider myself to be a jQuery expert but I easily scored 95% (19/20) on their quiz. Seeing the improper wording in that answer, I figured I'd confirm what I already suspected by posting here. My opinions on these kinds of certifications are now shifting."


EDIT:

I notified the W3Schools of the existence of this thread.


EDIT 2:

When I answered the original quiz question, I was thinking of $(window).load(), therefore my quiz answer was clearly incorrect. I believe this fact leaves none of the three multiple choice options as the correct answer. See my detailed answer below.

解决方案

The question is ambiguous.

The correct answer depends on your definition of document. If it is the DOM, it would be B. If it were the entire page's assets, it would be $(window).load(function() { ... }).

As you can see, this quiz sucks.

这篇关于另一个有问题的jQuery Quiz答案在W3Schools的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆