Solved

Newbie Javascript Question

Posted on 2015-01-07
2
94 Views
Last Modified: 2015-01-07
So I'm sure this is absurd, but I'm a newbie to Javascript development (very familiar with normal application development though, and familiar with .NET/Java as background.)  

I've got a simple html page as follows:
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>Test Page</title>
</head>
    <body>
        <div id="ecoFooter"><script src="ecobarRoot/ecoBar.js"></script></div>
    </body>
</html>

Open in new window


Then, the ecoBar.js file has this:  
initialize();

function initialize() {
	
	alert("This alert works...");
	
	var divFooter = document.getElementByID("ecoFooter");
	
	if (divFooter == null) {
		alert("Warning!  divFooter not found!");
	} else {
		alert("So far so good...");
	}
	
	alert("Test2");
	
	return;
	
}

Open in new window


I get the first alert, and then none of the alerts that follow.  Any ideas?
0
Comment
Question by:Javin007
2 Comments
 
LVL 38

Accepted Solution

by:
Tom Beck earned 500 total points
ID: 40535924
getElementById("ecoFooter");

Case sensitive on "Id", not "ID"
0
 
LVL 4

Author Closing Comment

by:Javin007
ID: 40535926
Oh wow. :P  Thanks.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses four methods for overlaying images in a container on a web page
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question