Home  >  Article  >  Web Front-end  >  The difference between document.getElementById method in Firefox and IE_javascript skills

The difference between document.getElementById method in Firefox and IE_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:26:531162browse

[Key points] The difference between document.getElementById method in Firefox and IE.
As follows, there is a text control with name="txtVersion":

Copy the code The code is as follows:





According to the above information, we need to use JS to get the value in its control. We write like this:
var strVersion= document.getElementById("txtVersion").value;
The above writing method does not work Wrong, it is correct in browsers with IE as the core, but Firefox has very strict requirements on this, and the above code cannot pass. In Firefox, when using the document.getElementById method, be sure to add the id="txtVersion" attribute to the control, as follows:
Copy code The code is as follows:


maxlength="25">
It suddenly broke. It was a DELL product. The accessories were not available for sale anywhere. I had no choice but to buy one on Taobao as the shelf life had expired. Taken this morning, hope to get it today.
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn