Drycodez Posted July 9, 2011 Share Posted July 9, 2011 What does the dots means?e.g: document.getElementById("element").value; I am confused and please, i need xplanations! Link to comment Share on other sites More sharing options...
Ingolme Posted July 9, 2011 Share Posted July 9, 2011 It's the operator that's used to access a property or method of an object.Study objects in the Javascript tutorial. Link to comment Share on other sites More sharing options...
jeffman Posted July 9, 2011 Share Posted July 9, 2011 It sometimes helps to think about something you already know. Lets construct a typical array: var myArray = new Array();myArray[0] = "Kim";myArray[1] = "Mary";myArray[2] = "Heinrich"; The array is numerically indexed. The identifier that goes inside the [brackets] is a number.The next array is an associative array. The indexes are strings instead of numbers. var myArray = new Array();myArray['car'] = "Honda";myArray['city'] = "London";myArray['country'] = "UK"; A lot of people do not realize that you can access an array element using dot notation. The following are equivalent: myArray['car']myArray.car The relationship between index notation and dot notation is true for ALL objects, not just arrays. In your example, the following are equivalent: document.getElementByIddocument['getElementById'] I hope that helps a little. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.