Document. getElementById ('text1'). Discourse Parsing!

Source: Internet
Author: User
Document. getElementById ('text1'). *** statement parsing !!! Do I need the source code? JScriptcodevarxmlhttp; functionhello () {xmlhttp = ajax1 (); document. getElementById ('text1'). *** statement parsing !!!
Do I need the source code?
JScript code
   var xmlhttp;    function hello(){       xmlhttp=ajax1();        var a=document.getElementById('a').value;        var b=document.getElementById('b').value;        var url='demo02.php?a='+a+'&b='+b;        xmlhttp.open('get',url);        xmlhttp.onreadystatechange=display;        xmlhttp.send();}    function display()    {        if(xmlhttp.readyState==4 && xmlhttp.status==200)            document.getElementById('text1').value=xmlhttp.responseText;    }


HTML code
  A
B
And yes:


I used to talk about this method when I was learning javascript.
However, I forgot it.
Today, I asked my buddy,
Document. getElementById ('text1') is used to obtain the text box.
Document. getElementById ('text1'). value is the value of the text box.

But then I changed it.
Document. getElementById ('text1'). innerHTMl can also be obtained.
W3c is too vague to understand,

Ladies and gentlemen, can you give me a general explanation?
If not, please point out ..

------ Solution --------------------
Document is a document object (entire webpage)
GetElementById () is a method of document objects. it is used to obtain elements with an ID attribute.
Therefore
Document. getElementById ('text1') gets the HTML node object with the id text1.
This node object has some attributes, such as value, innerHTML, and innerText.
These attributes are different. you can search for them and there will be a lot of long articles to introduce them in detail. you cannot understand them here.
------ Solution --------------------

Document. getElementById ('text1'). value
????

Div has no value attribute, so an error is required.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.