T
Terry A. Haimann
First of all be kind, I am new to javascript.
In the following page, can you tell me if I have defined the ObjTyp and
the ObjTypeCnt incorrectly. And if that is correct, why can't they be
seen from within my function ChangeSearch? Yes, the ObjTyp and ObjTypeCnt
are generated by a php script.
Thx in advance, Terry
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script LANGUAGE=JavaScript>
var ObjType = new array(
"Binary",
"Emis",
"Gal",
"Glob",
"Open",
"Open&Ems",
"Plan",
"Planet",
"SuprNovRem",
"");
var ObjTypeCnt = 9;
function ChangeSearch(srchstr)
{
i = document.SrchForm.SearchDB.value;
alert('Testing 1... ' + document.SrchForm.SearchDB.value)
// alert('Testing 2... ' + document.SrchForm.SearchDB.options.text)
if (i==2)
{
j = 0;
alert("ObjTypeCnt = " + ObjTypeCnt);
while (j < ObjTypeCnt)
{
var myNewOption = new option(j+1, ObjType[j]);
document.SrchForm.DetailDB.options[0] = myNewOption;
alert("j = " + j);
j++;
}
}
}
</SCRIPT>
<title>Astronomy Page</title>
<meta http-equiv="content-type"
content="text/html; charset=ISO-8859-1">
</head>
<body>
<div align="center"><big><big><big><big><big>Terry's Astronomy Page</big></big></big></big></big><br>
<form NAME=SrchForm>
<select NAME="SearchDB"
onChange="ChangeSearch()">
<option VALUE=0 SELECTED> Search By
<option VALUE=1>Object
<option VALUE=2>Type of Object
<option VALUE=3>Photographer
</select>
<select NAME="DetailDB">
</select>
</div>
<br>
<br>
</form>
</body>
</html>
In the following page, can you tell me if I have defined the ObjTyp and
the ObjTypeCnt incorrectly. And if that is correct, why can't they be
seen from within my function ChangeSearch? Yes, the ObjTyp and ObjTypeCnt
are generated by a php script.
Thx in advance, Terry
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script LANGUAGE=JavaScript>
var ObjType = new array(
"Binary",
"Emis",
"Gal",
"Glob",
"Open",
"Open&Ems",
"Plan",
"Planet",
"SuprNovRem",
"");
var ObjTypeCnt = 9;
function ChangeSearch(srchstr)
{
i = document.SrchForm.SearchDB.value;
alert('Testing 1... ' + document.SrchForm.SearchDB.value)
// alert('Testing 2... ' + document.SrchForm.SearchDB.options.text)
if (i==2)
{
j = 0;
alert("ObjTypeCnt = " + ObjTypeCnt);
while (j < ObjTypeCnt)
{
var myNewOption = new option(j+1, ObjType[j]);
document.SrchForm.DetailDB.options[0] = myNewOption;
alert("j = " + j);
j++;
}
}
}
</SCRIPT>
<title>Astronomy Page</title>
<meta http-equiv="content-type"
content="text/html; charset=ISO-8859-1">
</head>
<body>
<div align="center"><big><big><big><big><big>Terry's Astronomy Page</big></big></big></big></big><br>
<form NAME=SrchForm>
<select NAME="SearchDB"
onChange="ChangeSearch()">
<option VALUE=0 SELECTED> Search By
<option VALUE=1>Object
<option VALUE=2>Type of Object
<option VALUE=3>Photographer
</select>
<select NAME="DetailDB">
</select>
</div>
<br>
<br>
</form>
</body>
</html>