This is discovered by Sina colleague Xiaoniu, as follows
Two function Byselector,byid get the element through Queryselector and getElementById respectively.There is an element with the id "02e503e2a1c011cfc85b7b701a067
Today we have this problem when we have a string of values between pages.
Typeerror:document. getElementById is not a function.
Later, when developed in VS2010, there are two prompts behind the dot number, but the case is different, as follows:
1. The following is a simple example. A piece of information is displayed during page loading.
Copy codeThe Code is as follows: some information is output before the page is loaded
After execution, it is true that "information is output before page
Therefore, most scripts directly access the DOM through the element id. Later, with the advent of various browsers, ie was gradually replaced. Standardization is becoming more and more important to ensure the unified rules of various schools. The
This is what sina's colleague xiaoniu found:Copy codeThe Code is as follows: The bySelector and byId functions obtain the element through querySelector and getElementById respectively.The page contains the element "02e503e2a1c011cfc85b7b701a0677ec09
Function Code:Copy codeThe Code is as follows:Document. getElementByIdx_x = function (id ){If (typeof id = 'string ')Return document. getElementById (id );ElseThrow new error ('Please pass a string as a id! ')} Instance code:Copy codeThe Code is as
Today, I wrote a webpage. When I want to dynamically display data from other programs in the background when loading onLoad on the page, it is always null to use document. getElementById to get the control object. But check that this id does exist.
Get elements by IDIn the Web page we first find the label and then proceed with the ID.Grammar:document.getElementById ("id")Example:old header "Old Header" has been modified to "Hello world!!!". JavaScript Basics getElementById
Convert string type to byte []:
Byte [] bytearray = system. Text. encoding. Default. getbytes (STR );
In turn, byte [] is converted to string:
String STR = system. Text. encoding. Default. getstring (bytearray );
Other encoding methods, such as
Function f_framestyleresize (targobj)
{
VaR targwin = targobj.parent.doc ument. All [targobj. Name];
If (targwin! = NULL)
{
VaR heightvalue = targobj.doc ument. Body. scrollheight
If (heightvalue Targwin. style. pixelheight =
Recently I wrote a random simulation computing program. because it takes a long time to compute, some information should be output in the operation so that you can understand the progress of the operation and other information at any time. I
Environment:
1. Oracle 9i 9.2.0.8.0
2. JDBC: ojdbc5.jar
3. Spring 2
4. hibernate 3
There is an information management module in the system. The information content is edited using FCKeditor, And the content may be very long. Therefore, we decided
Many online users are currently engaged in video chat rooms on the webpage.
After learning, I also made a simple small example. Dozens of lines of JavaScript scripts can easily implement video calls, and I do not need to download a specified browser,
I. Element Node // test element node, output node name, node type, and node value varliElementsdocument. getElementsByTagName (& quot; li & quot;); for (vari0; I & lt; liElements. length; I ++) {alert (liElements [I]. nodeName);
I. Element nodes
//
/*Check whether the username is composed of letters, numbers, and underscores (_) and has a length of 6 to 20 characters.Output prompt information to the label with the ID of info*/Function checkname (){VaR infotext = "";VaR rename =/^/W {6, 20} $ /;
Js optimization works for IE6.0, which summarizes the following points:
I. String concatenation: concatenate strings with ArraysCopy codeThe Code is as follows:Function func2 (){Var start = new Date (). getTime ();Var array = [];For (var I = 0; I
Lib. js used in the filemanage function? 1.1.23 var indexnum = 10;
Var count = 0;
Function getmap (sFileName, sId ){
Var Uploadpic = "../filetype/unknown.gif ";
Var sExten = sFileName. substring (sFileName. lastIndexOf (".") + 1, sFileName.
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.