Closed Bug 263502 Opened 20 years ago Closed 20 years ago

group has no properties error when trying "group.length"

Categories

(Firefox :: General, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 231353

People

(Reporter: msclrhd, Assigned: bugzilla)

References

()

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20041001 Firefox/0.10.1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20041001 Firefox/0.10.1

// relevant JavaScript:
function loadGroups()
{
   var group = document.getElementById("jobGroup");
   group.length=groupArray.length; // <-- error here!
   for(var i=0; i<groupArray.length; i++)
   {
      group.options[i].text = groupArray[i].groupName;
      group.options[i].value = groupArray[i].groupId;
   }
}

<!-- relevant HTML -->
<select size="5" class="select" name="jobGroup" onChange="changeType();">
</select>


Reproducible: Always
Steps to Reproduce:
Go to http://www.jobcentreplus.gov.uk/cms.asp?Page=/Home/Customers/Searchforajob

The bug occurs in the iframe object. The box beneath "Select a Job Group from
the list" (the "jobGroup" object) should contain a list of items generated by
the JavaScript code highlighted above.
Actual Results:  
Nothing appears in the select box.

Expected Results:  
Displayed a list of items in the select box as generated by the JavaScript code.
because groupArray is not defined you cannot determine the length either
groupArray is defined in a html/head/script element, so this is not the 
problem. The following is a cut-down version of the problem:

-- begin --
<html><head>
<script>

function loadGroups()
{
   var group = document.getElementById("demo");
   group.length = 10; // error: group has no properties
   for( var i = 0; i < 10; ++i )
   {
      group.options[i].text  = "select " + i;
      group.options[i].value = "id" + i;
   }
}

</script>
</head><body onload = "loadGroups()">
<form><select size = "5" name = "demo"></select></form>
</body></hrml>
-- end --

Is this correct? MS IE6sp2 displays this ok.

*** This bug has been marked as a duplicate of 231353 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.