[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


IE7 Error 'Expected ']'

Posted on 2009-04-21
Medium Priority
Last Modified: 2013-12-08
I'm getting an error with this script (excerpt below - line 27) in IE7 but not in Firefox ... does anyone know why?

The error dialogue box is headed script error ..

'An error has occured on the script in this page'
Error: 'Expected ']'
Code: 0 (zero)

Do you want to continue running scripts?

Say yes and it still seems to work?

The scripts have come from Dream weaver (I think).


<script language="JavaScript" type="text/JavaScript">
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
<link href="css/grr.css" rel="stylesheet" type="text/css" />
<!-- InstanceBeginEditable name="head" -->
<link href="css/grr_new.css" rel="stylesheet" type="text/css" /> **** THIS IS THE LINE THAT SEEMS TO BE CAUSING THE PROBLEM
<!-- InstanceEndEditable -->

Open in new window

Question by:me_patrick
  • 6
  • 3
LVL 39

Expert Comment

ID: 24198330
I wouldn't mind helping you here, but with these kinds of scripts and the complexity of the DreamWeaver scripts, let alone possible includes, make it that the error from IE may be located in a totally different location (even though you get a line number, unfortunately it doesn't say much).

The best thing I can do to help you is load the page. Do you have it online somewhere?
LVL 19

Expert Comment

ID: 24198420
try replacing with this
<link href="css/grr_new.css" rel="stylesheet" type="text/css">
LVL 39

Expert Comment

ID: 24198953
@erikTsomik: this seems about a javascript error, how is the link css tag related to that? Don't be fooled by the line number, it is incorrect and points to an included file (which we haven't seen). And btw, changing from XHTML to HTML tags is usually not a good idea....

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.


Author Comment

ID: 24202143
Thanks giuys for the feedback:

i) This only happens when I reload the page - when you come to it first time it is ok.
ii) It is a php script and the only include I have have is a require_once statement which is bringing in a load of configuration constants.
iii) I test one of these constants and display a warning banner if I'm working in a development environment.
iv) The only scripts here are the ones that I have listed and they are not related to the link file at all.
iv) You were right the link line is a red herring - if I take it out I still get the same error.
vi) I'm not deliberately changing from XHTML to HTML tags - why do you think I am?
vii) Changing to <link href="css/grr_new.css" rel="stylesheet" type="text/css"> didn't make any difference.
LVL 39

Expert Comment

ID: 24202713
> vi) I'm not deliberately changing from XHTML to HTML tags - why do you think I am?
that was the solution of erikTsomik (which is why that comment said "@erikTsomik"). Sorry if that caused confusion. See also your point "vii".

> ii) It is a php script and the only include I have have is a require_once statement which is bringing in a load of configuration constants.

The php script is not at issue here, the error is browser side and in IE, it is a javascript error. All that we should investigate is the generated HTML+JavaScript.

The error you receive cannot be reproduced by the code you are showing. Can you either:

  - show the code of the whole page, including any includes/links etc
  - place the page somewhere (temporarily is ok) where we can see it
  - place your page and dependencies in a zip and upload it at http://ee-stuff.com

-- Abel --


Author Comment

ID: 24203195
Hi Abel,

The page is http://www.greatriverrace.co.uk/about.php.

LVL 39

Expert Comment

ID: 24203216
Thanks for posting. The error (actually, another error) also shows on FF. I'm showing you the relevant part of the debugger (note the screenshot for the exact location)

Error: missing ) after argument list
Source File: http://www.greatriverrace.co.uk/about.php
Line: 1, Column: 236
Source Code:

Open in new window

LVL 39

Accepted Solution

abel earned 2000 total points
ID: 24203228
For what I can tell, you have some quotes missing there. I.e., try this (not tested, and do check the rest of the line in the source, too):


Open in new window


Author Closing Comment

ID: 31572978
Thanks a lot abel - that's sorted it.
All the best.
LVL 39

Expert Comment

ID: 24203477
Glad it worked! Tx.

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question