Forum Moderators: mack

Message Too Old, No Replies

Error On Page

Syntax Error - but page seems to load ok.....

         

london77

1:24 pm on Feb 6, 2008 (gmt 0)

10+ Year Member



I have developed a site for a friend of mine using Dreamweaver 3.0 When I view the site in IE7 I get an 'Error On Page' warning -

Line:34
Char:12
Error: Syntax Error
Code:0

The page actually appears to load with no problems and when I refresh the warning disappears.

Here is the section of code where I beleive the problem is:

<html><!-- #BeginTemplate "/Templates/main.dwt" -->
<head>
<!-- #BeginEditable "doctitle" -->
<title>LLP</title>
<!-- #EndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="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) { //v3.0
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); 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];}
}
//-->
</script>
</head>

<body bgcolor="#FFFFFF" onLoad="LEFTMARGIN=;MM_preloadImages('../images/contact_on.jpg','../images/home_on.jpg','../images/about_on.jpg','../images/expertise_on.jpg')"0" TOPMARGIN="0" MARGINHEIGHT="0" MARGINWIDTH="0"">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%" align="center">
<tr>
<td>
<div align="center">
<table width="767" border="0" cellpadding="0" cellspacing="0" height="550" align="center" background="../images/main_bg.jpg">
<tr valign="top">
<td height="43"> <img src="../images/top_bar.jpg" height="78" border="0" usemap="../index.htm#Map"><map name="Map"><area shape="rect" coords="10,7,417,70" href="../index.htm"></map></td>
</tr>
<tr align="center">
<td height="2">
<table border=0 cellpadding=0 cellspacing=0>
<tr>
<td> <img src="../images/nav_bar_01.jpg" width=465 height=28></td>
<td> <a href="../index.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image15','','../images/home_off.jpg',1)"><img name="Image15" border="0" src="../images/home_on.jpg" width="55" height="28"></a></td>
<td> <img src="../images/nav_bar_03.jpg" width=3 height=28></td>
<td> <a href="about.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image16','','../images/about_off.jpg',1)"><img name="Image16" border="0" src="../images/about_on.jpg" width="73" height="28"></a></td>
<td> <img src="../images/nav_bar_05.jpg" width=3 height=28></td>
<td> <a href="expertise.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image17','','../images/expertise_off.jpg',1)"><img name="Image17" border="0" src="../images/expertise_on.jpg" width="75" height="28"></a></td>
<td> <a href="contact.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image14','','../images/contact_off.jpg',1)"><img name="Image14" border="0" src="../images/contact_on.jpg" width="93" height="28"></a></td>
</tr>
</table>

justgowithit

3:38 pm on Feb 6, 2008 (gmt 0)

10+ Year Member



You've got syntax soup in your <body> tag.

The margin declarations got mixed up with the call to the javascript funcion. It should look like:

<body bgcolor="#FFFFFF" onLoad="MM_preloadImages('../images/contact_on.jpg','../images/home_on.jpg','../images/about_on.jpg','../images/expertise_on.jpg')" LEFTMARGIN="0" TOPMARGIN="0" MARGINHEIGHT="0" MARGINWIDTH="0">

ergophobe

4:16 pm on Feb 6, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



For future reference, when you get an error on page in IE, that means that it's a Javascript problem as it was in this case(i.e. plain HTML and CSS won't cause an "error on page" message).

So that narrows down a little what you need to look at. Of course, if you don't understand the JS, that may not be very helpful advice...

Debugging 101

- start deleting elements from the page

- after each deletion, reload in the target browsers

- when problem goes away, you've figured out *where* it is.

- create a simple page that has nothing but the offending code and minimum of "framework code" to make it a valid page.

- does the problem still exist?

>Possibility A: If yes, figure out what's going wrong with this code, fix it, add it back into the original page. Done!

>Possibility B: If no, then it's an interaction between the code in question and something else. For example, with javascript, you are calling an undefined function and you need to define that function in your main JS file. Still, by locating where the problem is occurring, you should be able to spot things like that.

london77

4:23 pm on Feb 6, 2008 (gmt 0)

10+ Year Member



Thanks for your help.