Why does this not work when I move the code in the first script block (without the script tag itself) to an external javascript file.
The idea is to call homead.load() from home page and load everything processed by homead_build();
Error says 'homead not defined' using Firefox Error console
<div id="box">
</div>
<script type="text/javascript">
var homead = {
box_id: "box",
width: "150px",
load: function(){
homead.homead_build();
},
homead_build: function(){
var div = document.createElement('div');
div.style.width = homead.width;
div.style.height = '55px';
div.style.border = 'solid 2px #000';
var box = document.getElementById(homead.box_id);
box.appendChild(div);
}
};
</script>
<script language="JavaScript" type="text/javascript">
homead.load();
</script>