getelementbyid

getelementbyidgetelementbyid
  1. The method getElementById () could be used to find elements quickly .

    可以使用getElementById()方法快速找到元素。

  2. Both use the familiar getElementById function to get a reference to the SWF .

    都使用熟悉的getElementById函数获取SWF的引用。

  3. Now you can use getElementById () easily .

    现在可以很容易地使用getElementById()了。

  4. It is essentially a shortcut for the familiar document . getElementById () function .

    它也是类似的document.getElementById()函数的快捷方式。

  5. It represents an entire Web page , allows you access to powerful methods like getElementById (), and also allows you to create new nodes .

    它代表整个网页,提供了getElementById()这样功能强大的方法,还能够创建新的节点。

  6. ( Note : you are using $ () as an alias for document . getElementById () . )

    注意:您正在将$()用作document.getElementById()的一个别名。

  7. The global document object allows you to use DOM to access the various XUL elements , in this case by using getElementById to find an element by its unique ID.

    全局对象document允许您使用DOM访问各种XUL元素,本例中使用的是getElementById,可根据惟一ID查找元素。

  8. Prior to JavaScript libraries , using regular JavaScript , it was still quite easy to find a page element by its ID. The method getElementById () could be used to find elements quickly .

    在使用常规JavaScript的JavaScript库之前,通过ID查找页面元素还是相当简单的。可以使用getElementById()方法快速找到元素。

  9. First , you use the document . getElementById () function to select the content div ; you 'll need to access it later when you 're ready to display the random number generated by the script .

    首先,用document.getElementById()函数来选择contentdiv;稍后在显示由此脚本生成的随机数时,需要访问它。

  10. The XForms model is part of the page 's DOM , so you just use the document . getElementById () method , just like you would do to access an HTML div or an HTML input field .

    XForms模型是页面DOM的一部分,因此您只需使用document.getElementById()方法,正如您访问HTMLdiv或HTML输入字段那样。

  11. For example , the line var number = document . getElementById (" phone ") . value ; uses the DOM to find a specific element and then to retrieve the value of that element ( in this case , a form field ) .

    例如,代码行varnumber=document.getElementById(“phone”).value;使用DOM查找特定元素,然后检索该元素的值(在本例中是一个表单字段)。

  12. Instead of needing to do this three times , we could improve the efficiency of this operation by assigning the result of document . getElementById (" myField ") to a variable and using that in each line instead , as shown in Listing 7 .

    其实无需像这样执行三次,可以通过将document.getElementById(“myField”)结果赋给一个变量并在每行使用变量来提高效率。如清单7所示。