I am getting this message using some script that I got from the web
I actually found almost identical script from two sources and both give same problem
Error: 'document.globe.region' is null or not an object
The problem is in the onchange of this FORM script
<FORM name="globe">
<SELECT name="region" onchange="populateCountry(document.globe,document.globe.region.options[document.globe.region.selectedIndex].value)">
<OPTION value="">Select Region</OPTION>
<OPTION value="asia">Asia</OPTION>
<OPTION value="africa">Africa</OPTION>
</SELECT>
<SELECT name="country" onchange="populateUSstate(document.globe,document.globe.country.options[document.globe.country.selectedIndex].text)">
<OPTION value=""><--------------------</OPTION>
</SELECT>
</FORM>
Script code is below
<script language="javascript" >
<!-- Begin-->
var africaArray = new Array("('Select country','',true,true)",
"('Ethiopia')",
"('Somalia')",
"('South Africa')",
"('Other')");
var asiaArray = new Array("('Select country','',true,true)",
"('Armenia')",
"('Bangladesh')",
"('Cambodia')",
"('China')",
"('India')",
"('Other')");
function populateCountry(inForm,selected)
{
var selectedArray = eval(selected + "Array");
while (selectedArray.length < inForm.country.options.length)
{
inForm.country.options[(inForm.country.options.length - 1)] = null;
}
for (var i=0; i < selectedArray.length; i++)
{
eval("inForm.country.options=" + "new Option" + selectedArray);
}
if (inForm.region.options[0].value == '')
{
inForm.region.options[0]= null;
if ( navigator.appName == 'Netscape')
{
if (parseInt(navigator.appVersion) < 4)
{
window.history.go(0);
}
else
{
if (navigator.platform == 'Win32' || navigator.platform == 'Win16')
{
if(!document.getElementById)
window.history.go(0);
}
}
}
}
}
function populateUSstate(inForm,selected) {
var stateArray = new Array("('Select State','',true,true)",
"('Alabama')",
"('Wyoming')");
if (selected == 'USA') {
for (var i=0; i < stateArray.length; i++) {
eval("inForm.country.options=" + "new Option" + stateArray);
}
if ( navigator.appName == 'Netscape') {
if (parseInt(navigator.appVersion) < 4) {
window.history.go(0)
}
else {
if (navigator.platform == 'Win32' || navigator.platform == 'Win16') {
window.history.go(0)
}
}
}
}
else {
}
if (selected == 'Other') {
newCountry = "";
while (newCountry == ""){
newCountry=prompt ("Please enter the name of your country.", "");
}
if (newCountry != null) {
inForm.country.options[(inForm.country.options.length-1)]=new Option(newCountry,newCountry,true,true);
inForm.country.options[inForm.country.options.length]=new Option('Other, not listed','Other');
}
}
if(inForm.country.options[0].text == 'Select country') {
inForm.country.options[0]= null;
}
}// End -->
</script>
I actually found almost identical script from two sources and both give same problem
Error: 'document.globe.region' is null or not an object
The problem is in the onchange of this FORM script
<FORM name="globe">
<SELECT name="region" onchange="populateCountry(document.globe,document.globe.region.options[document.globe.region.selectedIndex].value)">
<OPTION value="">Select Region</OPTION>
<OPTION value="asia">Asia</OPTION>
<OPTION value="africa">Africa</OPTION>
</SELECT>
<SELECT name="country" onchange="populateUSstate(document.globe,document.globe.country.options[document.globe.country.selectedIndex].text)">
<OPTION value=""><--------------------</OPTION>
</SELECT>
</FORM>
Script code is below
<script language="javascript" >
<!-- Begin-->
var africaArray = new Array("('Select country','',true,true)",
"('Ethiopia')",
"('Somalia')",
"('South Africa')",
"('Other')");
var asiaArray = new Array("('Select country','',true,true)",
"('Armenia')",
"('Bangladesh')",
"('Cambodia')",
"('China')",
"('India')",
"('Other')");
function populateCountry(inForm,selected)
{
var selectedArray = eval(selected + "Array");
while (selectedArray.length < inForm.country.options.length)
{
inForm.country.options[(inForm.country.options.length - 1)] = null;
}
for (var i=0; i < selectedArray.length; i++)
{
eval("inForm.country.options=" + "new Option" + selectedArray);
}
if (inForm.region.options[0].value == '')
{
inForm.region.options[0]= null;
if ( navigator.appName == 'Netscape')
{
if (parseInt(navigator.appVersion) < 4)
{
window.history.go(0);
}
else
{
if (navigator.platform == 'Win32' || navigator.platform == 'Win16')
{
if(!document.getElementById)
window.history.go(0);
}
}
}
}
}
function populateUSstate(inForm,selected) {
var stateArray = new Array("('Select State','',true,true)",
"('Alabama')",
"('Wyoming')");
if (selected == 'USA') {
for (var i=0; i < stateArray.length; i++) {
eval("inForm.country.options=" + "new Option" + stateArray);
}
if ( navigator.appName == 'Netscape') {
if (parseInt(navigator.appVersion) < 4) {
window.history.go(0)
}
else {
if (navigator.platform == 'Win32' || navigator.platform == 'Win16') {
window.history.go(0)
}
}
}
}
else {
}
if (selected == 'Other') {
newCountry = "";
while (newCountry == ""){
newCountry=prompt ("Please enter the name of your country.", "");
}
if (newCountry != null) {
inForm.country.options[(inForm.country.options.length-1)]=new Option(newCountry,newCountry,true,true);
inForm.country.options[inForm.country.options.length]=new Option('Other, not listed','Other');
}
}
if(inForm.country.options[0].text == 'Select country') {
inForm.country.options[0]= null;
}
}// End -->
</script>