Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 747
  • Last Modified:

Invalid calling object in javascript, windows 7

I have the following javascript function in a php file.

function selectAll() {
      f = document.getElementById;
      for (n = 0; n < <?=count($Report)?>; n++) {
            e = f("OF"+n);
            if (e)
                  e.checked = true;
            }
      return false;
      }

This works fine with Windows XP, Internet Explorer 8 or Chrome.

In Windows 7 with IE 9 the debugger stops at the line e = f("OF"+n);
The same issue comes up with Chrome.

The script is supposed to check all checkboxes found in a list.

It seems to be a cross browser problem related to Windows 7 since the script works fine on computers running Win XP.

Thanks for any help provided.



0
JohanGLindberg
Asked:
JohanGLindberg
  • 3
  • 3
1 Solution
 
COBOLdinosaurCommented:
f = document.getElementById();

might solve the problem.

0
 
JohanGLindbergAuthor Commented:
Added a new problem saying f is not a function and stopped working on Win XP + IE as well.

I added the html code for the page. the scripts are called from the links at the end at
VALINTA: kaikki (Selsectall).

First I thought this must be an IE9 problem but the same problem exists in Chrome (where the scripts are working on XP) it might be related to Windows 7 as well?


html-code-with-scripts.htm
0
 
COBOLdinosaurCommented:
I would be very surprised if that form is not broken with all of the non-form tags in it.  iframe is unpredictable, and there are all kinds od cross-browser issues with tables especially when you don't have a valid dtd to tell the browser how to parse.

I would not even dream of trying to dig through that pile of code which you generated without linefeeds.  Two possible courses of action.  Cut down on the amount of stuff you are generating so you have a small enough data set to dig though the code.  Or, try setting some alerts to see  what is actually in the variables.  My gues is that Javasript cannot find the elements with the referenced ids even though they appear to be in the form.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
JohanGLindbergAuthor Commented:
IE:s compability-option solves it for ie9.

Thanks for your time and comments!
0
 
JohanGLindbergAuthor Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for JohanGLindberg's comment http:/Q_27423655.html#37099938

for the following reason:

The script works in compability mode even though it does not without.
0
 
COBOLdinosaurCommented:
If the questioner does not wish to proceed then the question should be deleted.  It ads zero value to the PAQ.  What he has done using compatibility mode is not a solution.  It is a hack that helps him and leaves 50% of visitors to the page with a problem.  All he did was tell IE 9 to pretend it is an old version of the browser. So any user who comes to the page using a modern browser including IE9 not in compatibility mode gets junk.  

Anyone with the same problem who comes to EE looking for a solution would then get this non-answer to their problem.  Delete please.
0
 
South ModModeratorCommented:
All,
 
Following an 'Objection' by COBOLdinosaur (at http://www.experts-exchange.com/Q_27437200.html) to the intended closure of this question, it has been reviewed by at least one Moderator and is being closed as recommended by the Expert.
 
At this point I am going to re-start the auto-close procedure.
 
Thank you,
 
SouthMod
Community Support Moderator
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now