问题描述
我是一名 .NET 程序员,刚刚开始学习更多有关客户端脚本的知识,我想知道有时您会使用 $get('value')
和 $find('value')
并且我发现这些只是 document.getElementById('value')
和 Sys.Application.findComponent('value')
,分别.
I'm a .NET programmer who've just started to learn more about client side scripting, and I was wondering sometimes you use $get('value')
and $find('value')
and I've discovered that these are just shortcuts for document.getElementById('value')
and Sys.Application.findComponent('value')
, respectively.
然而,我还是不明白:这两个函数在 JavaScript 中有什么区别?他们在调用时究竟在查找/检索什么?
However, I still don't understand: what is the difference between these two functions in JavaScript? What exactly are they looking up/retrieving when invoked?
提前致谢.
推荐答案
$get
&$find
是微软在他们的 Ajax JavaScript 库中内置的快捷功能.
$get
& $find
are shortcut functions Microsoft has built into their Ajax JavaScript Library.
$get
是标准 JavaScript 的缩写GetElementById
函数.$find
是 .Net 的 findComponent()
函数.这不是标准的 JavaScript 函数,而是特定于 Microsoft 的 Ajax JavaScript 库.
$get
is short for the standard JavaScript GetElementById
function. $find
is short for .Net's findComponent()
function. This is not a standard JavaScript function and is specific to Microsoft's Ajax JavaScript library.
马特·伯塞斯 (Matt Berseth) 对差异做了大量的记录并用法此处.
Matt Berseth does a great write up of the differences & usages here.
这篇关于JavaScript 中的 $get 和 $find 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!