473,386 Members | 1,819 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

defining and accessing js objects.

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[i].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>
Jul 20 '05 #1
1 1967
Hi,

A quick look at your code reveals some syntax typos:

array is different than 'Array' so change to 'Array'.
Same applies for 'option' =>change to: 'Option'

--
Elias
"Terry A. Haimann" <te***@yngstr.oldboy.com> wrote in message
news:pa****************************@yngstr.oldboy. com...
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[i].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>

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Dotnetified | last post by:
Reposting after about 2 weeks of no response ... thanks if you can help... ---------------------------------------------------------------------------- -------------- To anyone who thinks they...
4
by: Jaydeep | last post by:
Hello, I am facing a strange problem. Problem accessing remote database from ASP using COM+ server application having VB components (ActiveX DLL) installed. Tier 1 : ASP front End (IIS 5.0) Tire...
9
by: ree | last post by:
Unlike arrays I am having problems accessing objects placed in a vector I have a vector of objects called Semesters Each Semester has its own vector of Subjects. I am having problems...
3
by: Alex | last post by:
I'm having a problem porting an ASP solution to ASPX. In the ASP solution I'm accessing a DCOM server, create sub DCOM objects and call functions from VB script on the ASP pages. The DCOM object...
16
by: Howard Jess | last post by:
All -- I'm trying to solve a problem for which I think the solution will be to *cheat*; but I don't mind doing so for this case. The background is: Given an object constructor, and an instance...
0
by: sonu | last post by:
I have following client side code which i have used in my asp.net project SummaryFeatured Resources from the IBM Business Values Solution Center WHITEPAPER : CRM Done Right Improve the...
14
by: James Thiele | last post by:
I'd like to access the name of a function from inside the function. My first idea didn't work. >>> def foo(): .... print func_name .... >>> foo() Traceback (most recent call last): File...
5
by: feli.hp | last post by:
Hello all, Imaybe someone can help me with this question. Is there a direct way of accessing an object instance, if all I know is the value of one of its attributes? The object is part of a...
5
by: Paul Brettschneider | last post by:
Hello, I have a global static array of structs and want to access a given element using an identifier. I don't want to use the element subscript, because it will change if I insert elements...
1
by: Peter | last post by:
Hi, I have a Dictionary<key, valuewhich is accessed by three threads. One thread puts my value objects in the dictionary (occasionally), and also updates the contents of existing value objects -...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.