473,407 Members | 2,306 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,407 software developers and data experts.

Firefox error obj.style has no properties

Greetings all. If only I was a little braver I would just shoot myself and end my misery but since I am not - please shoot me!!! I mean HELP me :)

Picture a named form with contents defined as follows:

[HTML]
<form name="myform">
<div id="extrawhatever" style="visibility: 'hidden'> <!-- div and select do share -->
<select name="extrawhatever"> <!-- common name/id value -->
<!-- options will be filled in dynamically later -->
</select>
</div>
<input type="text" name="whatever" id="whatever" onfocus="prepmyList();">
...
</form>
[/HTML]

As I understand things, if an form element has focus its container (form) MUST exist in the memory space right??? If I can use getElementById('whatever') on one line of code it should also work on the next line? So now the focus handler contains:

Expand|Select|Wrap|Line Numbers
  1. function prepmyList(arg) {
  2.     var x = new getObj('extra'+arg); // ref hidden div from above by id so I can
  3.    // make it visible after it is populated
  4.     ...
  5. }
  6.  
  7. function  getObj(arg) {
  8.     this.obj = document.getElementById(arg);     // THIS WORKS FINE!!!!
  9.     this.style = document.getElementById(arg).style;   // ERROR NO PROPERTIES
  10.     ....
  11. }
  12.  
Note that IE6 and 7 run this just fine. Firefox is the complainer. I am trying to use Firebug to debug another area of my code that is after this point.

This is driving me on the short trip to CRAZY. Anybody got a grip on it? Any ideas will be greatly appreciated.

Impeach the whole government!
Dan Ellison
Apr 27 '07 #1
3 4657
iam_clint
1,208 Expert 1GB
try

this.style = document.getElementById(arg).style;

to
this.style = this.obj.style;


and it may be something silly like firefox may not take .style as a whole but it prolly wants individual styles

this.style.width = this.obj.style.width;
Apr 27 '07 #2
try

this.style = document.getElementById(arg).style;

to
this.style = this.obj.style;


and it may be something silly like firefox may not take .style as a whole but it prolly wants individual styles

this.style.width = this.obj.style.width;
Thanks for the suggestions Clint. The first approach you are suggesting I don't think will work because the context of the object is such that a reference to "this" outside of the constructor will be an undefined object (or am I off track with that?)

The way the objects are used is such that I don't think that the style attribute is a subset of obj....

The later explanation is probably right on for firefox. It might be seeing this.style as an incomplete specification. This crossplatform stuff can be maddening! I do appreciate the assistance and I will see if I can make use of the suggestions.

Thanks,
Dan
Apr 27 '07 #3
pbmods
5,821 Expert 4TB
Expand|Select|Wrap|Line Numbers
  1. function  getObj(arg) {
  2.     this.obj = document.getElementById(arg);     // THIS WORKS FINE!!!!
  3.     this.style = document.getElementById(arg).style;   // ERROR NO PROPERTIES
  4.     ....
  5. }
  6.  
How about this, then:

Expand|Select|Wrap|Line Numbers
  1. function  getObj(arg) {
  2.     var $theObj = document.getElementById(arg);
  3.     this.obj = $theObj;
  4.     this.style = $theObj.style;
  5.     ....
  6. }
  7.  
Apr 28 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: mike | last post by:
I have a page that uses a some javascript and it works fine in IE but fails to work in Firefox. Basically what I'm trying to do is have 3 iframes on a page but only displaying one of them at a...
2
by: Cy | last post by:
Hi, I have a menu that toggles correctly in IE but is failing in FireFox V.1 and Netscape 7.1. The FireFox JavaScript Console is returning the following error; Error:...
2
by: Stewart | last post by:
Originally posted in comp.lang.javascript: Newsgroups: comp.lang.javascript From: "Stewart" Date: 23 Aug 2005 02:50:04 -0700 Local: Tues, Aug 23 2005 10:50 am Subject: FireFox, RemoveChild,...
3
by: davidkarlsson74 | last post by:
Error: document.getElementById("folderMenu").cells has no properties File: http://www.volkswagen.se/tillbehor/js/foldermenu.js Rad: 49 The function activates different DIV:s, but doesn't seem to...
5
by: Martin Chen | last post by:
I have a frame set (as per MS FrontPage 2000). It has a contents and a main frame. The contents frame has a menu bar written with with javascript (in the context of a table). In IE6.1 everything...
1
by: KPS | last post by:
I'm attempting to create a simple treeview-like behavior in JavaScript. The desired behavior happens in IE but I cannot get the same to happen in FireFox. The primary thing I want to accomplish...
7
by: Coder | last post by:
Hi I have the following code in java script, it is not giving proper output in FIREFOX but running fine in IE... can anybody help me out to make this run in FIREFOX . <script...
2
by: Serena | last post by:
I have a problem whit this script. It is compatible with IE but isn't with Firefox. The error are: 1) "e has no properties" at----- "if(e.pageX || e.pageY) {" 2) "document.getElementById()"...
2
Mobius Evalon
by: Mobius Evalon | last post by:
I'm trying to make this thing work in Firefox, because I know the client my game is on is pondering switching to Gecko (they're currently using something very similar to IE4 for browser windows...
9
by: =?Utf-8?B?Sm9obiBCYWlsZXk=?= | last post by:
I have a ASP .Net page that allows moving around items on the page through javascript. This page works fine in IE. In FireFox however, I have found that if the page is using XHTML 1.0...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.