473,721 Members | 4,051 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Object Expected error

Hello-

I'm running a php front end app on mysql. When viewing the page with
Firefox, no error. When viewing with IE6, always get the following
error:

Line: 210
Char: 3
Error: Object expected
Code: 0

the error points to the following code:

for (i=0;i<9;i++) //number of folders here
{
switchDIV('f'+i );
}

specifically it points to the line with 2 blank spaces and switchDIV

Does anybody know of an easy way to fix this code? Do you need to see
more code to get an idea?

thank you!
PS

Mar 14 '06 #1
7 4610
VK

Shanimal wrote:
Hello-

I'm running a php front end app on mysql. When viewing the page with
Firefox, no error. When viewing with IE6, always get the following
error:

Line: 210
Char: 3
Error: Object expected
Code: 0

the error points to the following code:

for (i=0;i<9;i++) //number of folders here
{
switchDIV('f'+i );
}

specifically it points to the line with 2 blank spaces and switchDIV

Does anybody know of an easy way to fix this code? Do you need to see
more code to get an idea?


This code is fine by itself (except you should declare i as local
instead of making it global: for (var i=0; i<9; i++)

Looks like IE6 cannot find switchDIV function. Are you sure it works
(means produces expected results) in Firefox? What switchDIV is? Do you
have a link to look at?

Mar 14 '06 #2
Ivo
"Shanimal"w rote
Hello-

I'm running a php front end app on mysql. When viewing the page with
Firefox, no error. When viewing with IE6, always get the following
error:

Line: 210
Char: 3
Error: Object expected
Code: 0

the error points to the following code:

for (i=0;i<9;i++) //number of folders here
{
switchDIV('f'+i );
}

specifically it points to the line with 2 blank spaces and switchDIV


Type in your IE addressbar this line of code:
javascript: alert( switchDIV );
This will tell you if IE knows about your function. If not, you get the
object exprected error message and the next step is finding out why (are
other functions also gone?). If it does, you see the code of the function,
and you know you need elsewhere.
hth
ivo
http://www.yorick.onlyfools.com/
Mar 14 '06 #3
Thanks for the help!

I checked and IE did't know about the function.

I made the change that VK suggested, and now the error is gone!

You guys rock for helping me out with this!

thanks again
PS

Mar 14 '06 #4
Major brain cramp! The change didn't eliminate the error at all. I
guess the browser I tested with already was set to ignore the error.
Sorry about that. Maybe if I include more code somebody can figure out
how I should declare the switchDIV variable.

<script type="text/javascript">
<!--
function switchUl(id){
if(document.get ElementById){
a=document.getE lementById(id);
a.style.display =(a.style.displ ay!="none")?"no ne":"block";
}
}
for(var i=0;i<9;i++) //number of folders HERE
{
switchDIV('f'+i );
}
// -->
</SCRIPT>

Mar 14 '06 #5

Shanimal wrote:
Major brain cramp! The change didn't eliminate the error at all. I
guess the browser I tested with already was set to ignore the error.
Sorry about that. Maybe if I include more code somebody can figure out
how I should declare the switchDIV variable.

<script type="text/javascript">
<!--
function switchUl(id){
if(document.get ElementById){
a=document.getE lementById(id);
a.style.display =(a.style.displ ay!="none")?"no ne":"block";
}
}
for(var i=0;i<9;i++) //number of folders HERE
{
switchDIV('f'+i );
}
// -->
</SCRIPT>


Greetings,

You'll hate yourself for this, but I do it all the time. You are
calling a function called switchDIV() when your actual function is
called switchUl();

Hope that helps,
- Peter Schmalfeldt

Mar 14 '06 #6
Peter-

I've tried both variations on this:

<script type="text/javascript">
<!--
function switchUl(id){
if(document.get ElementById){
a=document.getE lementById(id);
a.style.display =(a.style.displ ay!="none")?"no ne":"block";
}
}
for(var i=0;i<9;i++) //number of folders HERE
{
switchUI('f'+i) ;
}
// -->
</SCRIPT>

and I also tried this:

<script type="text/javascript">
<!--
function switchDIV(id){
if(document.get ElementById){
a=document.getE lementById(id);
a.style.display =(a.style.displ ay!="none")?"no ne":"block";
}
}
for(var i=0;i<9;i++) //number of folders HERE
{
switchDIV('f'+i );
}
// -->
</SCRIPT>

Each time I get a different error

Error: Object required

which points to this line:

a.style.display =(a.style.displ ay!="none")?"no ne":"block";

I have no jscript experience, just some vbscript. I'm attempting to use
an open source application so I'm getting a crash course on PHP and now
jscript. unfortunately since it's open source software it's difficult
to get the authors to respond to this issue.

thank you
PS

Mar 14 '06 #7

Shanimal wrote:
Peter-

I've tried both variations on this:

<script type="text/javascript">
<!--
function switchUl(id){
if(document.get ElementById){
a=document.getE lementById(id);
a.style.display =(a.style.displ ay!="none")?"no ne":"block";
}
}
for(var i=0;i<9;i++) //number of folders HERE
{
switchUI('f'+i) ;
}
// -->
</SCRIPT>

and I also tried this:

<script type="text/javascript">
<!--
function switchDIV(id){
if(document.get ElementById){
a=document.getE lementById(id);
a.style.display =(a.style.displ ay!="none")?"no ne":"block";
}
}
for(var i=0;i<9;i++) //number of folders HERE
{
switchDIV('f'+i );
}
// -->
</SCRIPT>

Each time I get a different error

Error: Object required

which points to this line:

a.style.display =(a.style.displ ay!="none")?"no ne":"block";

I have no jscript experience, just some vbscript. I'm attempting to use
an open source application so I'm getting a crash course on PHP and now
jscript. unfortunately since it's open source software it's difficult
to get the authors to respond to this issue.

thank you
PS


Greetings,

I think you might be loading your function before your divisions are
actually rendered by your browser. This would cause the error that you
are having. If your code instructs the browser to hide a division
before it is rendered it yells at you. On firefox you would not get any
errors unless you looked at the javascript console.

Here is a version of your code that I tested in Firefox and IE and it
runs fine:

<div id="f0">0</div>
<div id="f1">1</div>
<div id="f2">2</div>
<div id="f3">3</div>
<div id="f4">4</div>
<div id="f5">5</div>
<div id="f6">6</div>
<div id="f7">7</div>
<div id="f8">8</div>

<script type="text/javascript">
function switchDIV(id){
if(document.get ElementById){
a = document.getEle mentById(id);
a.style.display =(a.style.displ ay!="none")?"no ne":"block";
}
}
for(var i=0;i<9;i++){
switchDIV('f'+i );
}
</SCRIPT>

Notice that the script comes after the DIV tags. This way the code will
run without any errors. Anotherway you could use this code is to place
the following code in your head tag:

<HEAD>
<script type="text/javascript">
function switchDIV(id){
if(document.get ElementById){
a = document.getEle mentById(id);
a.style.display =(a.style.displ ay!="none")?"no ne":"block";
}
}
function toggleDivs(){
for(var i=0;i<9;i++){
switchDIV('f'+i );
}
}
</SCRIPT>
</HEAD>

And this in your body:

<BODY>
<div id="f0">0</div>
<div id="f1">1</div>
<div id="f2">2</div>
<div id="f3">3</div>
<div id="f4">4</div>
<div id="f5">5</div>
<div id="f6">6</div>
<div id="f7">7</div>
<div id="f8">8</div>
<input type="button" value="Toggle" onClick="toggle Divs()">
</BODY>

This will allow you to have abutton that toggles the divs off and on.

Tested it and it works great.

I posted the script on my server here if you wanted to download the
code without it getting broken up like it can sometimes on these sites:

http://www.manifestinteractive.com/u...oggle_div.html

Hope this helps,
- Peter Schmalfeldt

Mar 14 '06 #8

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

Similar topics

4
44875
by: Bill | last post by:
I call a function in my .js file like this: onClick="location.href='blank.html' + generateSearchStringFromForm('section')" where section is the name of my form. The function is defined as follows: myFunction(k) {
2
2281
by: jsnX | last post by:
i want a function object that is a) initialized with an STL container foo b) will search foo for an object of type foo::value_type here is my code: ======================================================================== /* if we have a big list of things, and we went to check it * over and over for this or that thing, then we can use this * object to cache the list and consolidate queries of it.
2
1133
by: FredC | last post by:
OS Name Microsoft Windows XP Professional Version 5.1.2600 Service Pack 2 Build 2600 Total Physical Memory 1,024.00 MB MDE 2003 Version 7.1.3008 ..NET Framework 1.1 Version 1.1.4322 SP1 Microsoft Visual C# .NET 69462-335-0000007-18707 Crystal Reports for Visual Studio .NET AAP50-GS0000S-WCK00C3
11
44255
by: westplastic | last post by:
This one is driving me insane. The script works perfect on Firefox, but Internet Explorer keeps complaining about "Error Object Expected" and stuff like that. I've run it through Firefox's Java Console, and it comes back with no errors. Any pointers on this, would be much appreciated. <script type="text/javascript"> <!-- var p = new Array(0,0,0,0,0) var c = new Array(0,0,0,0,0,0,0,0,0)
26
5686
by: yb | last post by:
Hi, Is there a standard for the global 'window' object in browsers? For example, it supports methods such as setInterval and clearInterval, and several others. I know that w3c standardized several parts of the DOM, but this does not include the window object. Thank you
12
5554
by: Andrew Poulos | last post by:
With the following code I can't understand why this.num keeps incrementing each time I create a new instance of Foo. For each instance I'm expecting this.num to alert as 1 but keeps incrementing. Foo = function(type) { this.num = 0; this.type = type this.trigger(); } Foo.prototype.trigger = function() {
4
2780
by: loserdude84 | last post by:
Hi I keep getting the good old error 'Object Expected Error' on a site I recently built. I am really struggling with this one. Object Expected Error Line 66 <div class="headerBG_2"></div> <div class="contentBG_2"> <!-- flash banner --> <div class="flash_banner"> LINE 66 <script type="text/javascript">
1
3915
by: JOJO123 | last post by:
I got here in search of an answer to this Javascrpt question. I upgraded jave on XP Ie 7, acrobat 5.1 and suddenly can't open any pdf files on web sites using IE. I see u guys all say, this is a Javscript issue. but how do we, mere mortals who know nothing of anything about Java, scripts, etc, fix this? Is there a programm, does MS have any fix? is there any tweak like in the Registry, or whatever, how do I access anyihint java without in IE 7...
10
13319
RMWChaos
by: RMWChaos | last post by:
WinVista/IE7 I am getting some weird errors only in IE7, but not in FF2.0.0.8 or NN9. It even happens on this website when I click "Sign In". The error is: "A Runtime Error has occurred." "Line:xxx" "Error: Object expected" and Debug says: "Microsoft JScript runtime error: Object expected."
2
5743
by: thj | last post by:
Hi. I've got this form that I'm trying to validate: <form id="periodForm" action="" method="post"> <p> Periode: <input id="startDate" name="startDate" type="text" size="7" value="<%= ViewData %>" /> -
0
9373
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9227
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9143
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9077
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8019
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6676
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5992
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4497
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4761
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.