WHO WOT ME

WHO WOT ME

We love the random - videos, images, games and much much more visit us @ www.whowotme.com

getElementById returns null

Hi,

Suppose I have the following inside a function:

JavaScript Code:
document.getElementById('display_content').innerHTML = "hello";

The above works. However, when I define it like the following it says display_content is null on firefox error console.

JavaScript Code:
var display_content = document.getElementById('display_content');
 
function render()
{
    display_content.innerHTML = "hello";
}

Any suggestions? when I replace display_content with document.getElementById('display_content'), it works.
Sponsors
Comments
Be the first to leave a comment!
Add a Comment:
Already a member? Log In
Sponsors
About the Author

8 Kudos
Top Entertainment Articles
Best of Paparazzi Girls
Here are the girls largely responsible for keeping the paparazzi machine humming.
Zimbio Caption Contest: Enter and Win $25 at Amazon.com!
This is possibly the easiest photo to caption. It practically writes itself.
Amber Rose Goes Topless in Miami, Children Unfazed
Uh, are there topless beaches in Miami that allow children?
More From Zimbio
Copyright © 2009 - Zimbio, Inc. Some rights reserved.