object created in javascript gets "xxxx has no properties"

RESOLVED INVALID

Status

()

Toolkit
Form Manager
RESOLVED INVALID
14 years ago
10 years ago

People

(Reporter: Morrie Marino, Assigned: Ben Goodger (use ben at mozilla dot org for email))

Tracking

1.7 Branch
x86
Windows 98
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

14 years ago
An object created in javascript code gets a "has no properties" error when the 
focus() method is used.

The following line:

frm.frmLeagues.focus();

in the following code causes the error:

<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>NITTL Standings</title>

<script LANGUAGE="JavaScript" FOR="window" EVENT="onLoad()">
<!--
	var frm = new Object();
	frm = document.formLeagueList;
	frm.frmLeagues.focus();
//-->
</script>

</head>

<body bgcolor="#C0C0C0">
Despite Microsoft's claim in
http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/htmlfor_0.asp
that

<script LANGUAGE="JavaScript" FOR="window" EVENT="onLoad()">

is defined in the DOM Level 2 spec as saying the script contents should be
assigned to the window.onload, it ain't. The htmlFor property was reserved for
future use, and that's it, and in every browser on Earth except IE, that script
will run inline, as soon as the <head> is parsed, and fail because the form
hasn't been seen yet, or just won't run at all. Put that script in a function,
call the function from <body onload="">, and it will work fine in everything.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 14 years ago
Resolution: --- → INVALID
Product: Firefox → Toolkit
You need to log in before you can comment on or make changes to this bug.