Tzafrir
11-05-2003, 04:38 PM
im using a javascript menu and it works fine when i put it in an html file. But im trying to put it in a js file and call it from an HTML. I know its calling it correctly because when i take the javascript menu out it all works fine, but as soon as the menu goes in the error comes up.
The error is:
Line:3
Char:1
object expected
does anyone know the reason for this?
the js file contains the following:
document.write("<tr>");
document.write("<td width=\"110\" height=\"40\" bgcolor=\"#c6cfde\">");
document.write(" ");
document.write("</td>");
document.write("<td width=\"1\" height=\"40\" bgcolor=\"#001c42\">");
document.write("</td>");
document.write("<td width=\"894\" height=\"40\" bgcolor=\"#ffffef\" align=\"center\" valign=\"top\">");
document.write("<!--Links used to initiate the sub menus. Pass in the desired submenu index numbers (ie: 0, 1) -->");
document.write("<a class=myLink href=\"index.html\" onMouseover=\"showit(0)\"><font face=\"Times New Roman\" color=\"#001c42\"><b>HOME</b></font></a> | <a class=myLink href=\"indexv10.html\" onMouseover=\"showit(1)\"> <font face=\"Times New Roman\" color=\"#001c42\"><b>MANAGEMENT & PEOPLE</b></font></a> | <a class=myLink href=\"indexv10.html\" onMouseover=\"showit(2)\"><font face=\"Times New Roman\" color=\"#001c42\"><b>SERVICES</b></font></a> | <a class=myLink href=\"indexv10.html\" onMouseover=\"showit(3)\"><font face=\"Times New Roman\" color=\"#001c42\"><b>NEWS & VIEWS</font></a> | <a class=myLink href=\"indexv10.html\" onMouseover=\"showit(4)\"><font face=\"Times New Roman\" color=\"#001c42\"><b>CONTACT US</b></font></a><br>");
document.write("<!-- Edit the dimensions of the below, plus background color-->");
document.write("<ilayer width=989 height=20 name=\"dep1\" bgColor=\"#FEFEE9\">");
document.write("<layer name=\"dep2\" width=989 height=20>");
document.write("</layer>");
document.write("</ilayer>");
document.write("<div id=\"describe\" style=\"background-color:\"#FEFEE9\";width:989px;height:20px\" onMouseover=\"clear_delayhide()\" onMouseout=\"resetit(event)\"></div>");
document.write("<script language=\"JavaScript1.2\">");
document.write("/*");
document.write("Tabs Menu (mouseover)- By Dynamic Drive");
document.write("For full source code and more DHTML scripts, visit http://www.dynamicdrive.com");
document.write("This credit MUST stay intact for use");
document.write("*/");
document.write("var submenu=new Array()");
document.write("//Set submenu contents. Expand as needed. For each content, make sure everything exists on ONE LINE. Otherwise, there will be JS errors.");
document.write("submenu[0]=\'\'");
document.write("submenu[1]=\'<font face=\"Times New Roman\" color=\"#4a658c\"><b><a class=myLink href=\"indexv10.html\"><font face=\"Times New Roman\" color=\"#4a658c\">PROFESSIONAL ADVISERS</font></a> | <a class=myLink href=\"indexv10.html\"><font face=\"Times New Roman\" color=\"#4a658c\">ADMINISTRATION</font></a></b></font>\'");
document.write("submenu[2]=\'<font face=\"Times New Roman\" color=\"#4a658c\"><b><a class=myLink href=\"indexv10.html\"><font face=\"Times New Roman\" color=\"#4a658c\">PRIVATE CLIENTS</font></a> | <a class=myLink href=\"indexv10.html\"><font face=\"Times New Roman\" color=\"#4a658c\">CORPORATE CLIENTS</font></a> | <a class=myLink href=\"indexv10.html\"><font face=\"Times New Roman\" color=\"#4a658c\">CLIENT DEMOGRAPHICS</font></a> | <a class=myLink href=\"indexv10.html\"><font face=\"Times New Roman\" color=\"#4a658c\">FAQ\\'S</font></a></b></font>\'");
document.write("submenu[3]=\'<font face=\"Times New Roman\" color=\"#4a658c\"><b><a class=myLink href=\"indexv10.html\"><font face=\"Times New Roman\" color=\"#4a658c\">NEWSLETTERS</font></a> | <a class=myLink href=\"indexv10.html\"><font face=\"Times New Roman\" color=\"#4a658c\">PRESS RELEASES</font></a> | <a class=myLink href=\"indexv10.html\"><font face=\"Times New Roman\" color=\"#4a658c\">LINKS</font></a> | <a class=myLink href=\"indexv10.html\"><font face=\"Times New Roman\" color=\"#4a658c\">INVESTMENT READING</font></a></b></font>\'");
document.write("submenu[4]=\'<font face=\"Times New Roman\" color=\"#4a658c\"><b><a class=myLink href=\"indexv10.html\"><font face=\"Times New Roman\" color=\"#4a658c\">GENERAL MAILBOX</font></a> | <a class=myLink href=\"indexv10.html\"><font face=\"Times New Roman\" color=\"#4a658c\">YOUR ADVISOR</font></a></b></font>\'");
document.write("//Set delay before submenu disappears after mouse moves out of it (in milliseconds)");
document.write("var delay_hide=0");
document.write("//No need to edit beyond here");
document.write("var menuobj=document.getElementById? document.getElementById(\"describe\") : document.all? document.all.describe : document.layers? document.dep1.document.dep2 : \"\"");
document.write("function showit(which){");
document.write("clear_delayhide()");
document.write("thecontent=(which==-1)? \"\" : submenu[which]");
document.write("if (document.getElementById||document.all)");
document.write("menuobj.innerHTML=thecontent");
document.write("else if (document.layers){");
document.write("menuobj.document.write(thecontent)");
document.write("menuobj.document.close()");
document.write("}");
document.write("}");
document.write("function resetit(e){");
document.write("if (document.all&&!menuobj.contains(e.toElement))");
document.write("delayhide=setTimeout(\"showit(-1)\",delay_hide)");
document.write("else if (document.getElementById&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))");
document.write("delayhide=setTimeout(\"showit(-1)\",delay_hide)");
document.write("}");
document.write("function clear_delayhide(){");
document.write("if (window.delayhide)");
document.write("clearTimeout(delayhide)");
document.write("}");
document.write("function contains_ns6(a, b) {");
document.write("while (b.parentNode)");
document.write("if ((b = b.parentNode) == a)");
document.write("return true;");
document.write("return false;");
document.write("}");
document.write("</script>");
document.write("</td>");
document.write("</tr>");
document.write("</Table>");
document.write("</TD>");
document.write("</TR>");
document.write("</TABLE>");
document.write("</BODY>");
document.write("</HTML>");
and im calling it from the html file using:
<Script language="javascript" src="pageend4.js"></script>
thanks
tzaf
The error is:
Line:3
Char:1
object expected
does anyone know the reason for this?
the js file contains the following:
document.write("<tr>");
document.write("<td width=\"110\" height=\"40\" bgcolor=\"#c6cfde\">");
document.write(" ");
document.write("</td>");
document.write("<td width=\"1\" height=\"40\" bgcolor=\"#001c42\">");
document.write("</td>");
document.write("<td width=\"894\" height=\"40\" bgcolor=\"#ffffef\" align=\"center\" valign=\"top\">");
document.write("<!--Links used to initiate the sub menus. Pass in the desired submenu index numbers (ie: 0, 1) -->");
document.write("<a class=myLink href=\"index.html\" onMouseover=\"showit(0)\"><font face=\"Times New Roman\" color=\"#001c42\"><b>HOME</b></font></a> | <a class=myLink href=\"indexv10.html\" onMouseover=\"showit(1)\"> <font face=\"Times New Roman\" color=\"#001c42\"><b>MANAGEMENT & PEOPLE</b></font></a> | <a class=myLink href=\"indexv10.html\" onMouseover=\"showit(2)\"><font face=\"Times New Roman\" color=\"#001c42\"><b>SERVICES</b></font></a> | <a class=myLink href=\"indexv10.html\" onMouseover=\"showit(3)\"><font face=\"Times New Roman\" color=\"#001c42\"><b>NEWS & VIEWS</font></a> | <a class=myLink href=\"indexv10.html\" onMouseover=\"showit(4)\"><font face=\"Times New Roman\" color=\"#001c42\"><b>CONTACT US</b></font></a><br>");
document.write("<!-- Edit the dimensions of the below, plus background color-->");
document.write("<ilayer width=989 height=20 name=\"dep1\" bgColor=\"#FEFEE9\">");
document.write("<layer name=\"dep2\" width=989 height=20>");
document.write("</layer>");
document.write("</ilayer>");
document.write("<div id=\"describe\" style=\"background-color:\"#FEFEE9\";width:989px;height:20px\" onMouseover=\"clear_delayhide()\" onMouseout=\"resetit(event)\"></div>");
document.write("<script language=\"JavaScript1.2\">");
document.write("/*");
document.write("Tabs Menu (mouseover)- By Dynamic Drive");
document.write("For full source code and more DHTML scripts, visit http://www.dynamicdrive.com");
document.write("This credit MUST stay intact for use");
document.write("*/");
document.write("var submenu=new Array()");
document.write("//Set submenu contents. Expand as needed. For each content, make sure everything exists on ONE LINE. Otherwise, there will be JS errors.");
document.write("submenu[0]=\'\'");
document.write("submenu[1]=\'<font face=\"Times New Roman\" color=\"#4a658c\"><b><a class=myLink href=\"indexv10.html\"><font face=\"Times New Roman\" color=\"#4a658c\">PROFESSIONAL ADVISERS</font></a> | <a class=myLink href=\"indexv10.html\"><font face=\"Times New Roman\" color=\"#4a658c\">ADMINISTRATION</font></a></b></font>\'");
document.write("submenu[2]=\'<font face=\"Times New Roman\" color=\"#4a658c\"><b><a class=myLink href=\"indexv10.html\"><font face=\"Times New Roman\" color=\"#4a658c\">PRIVATE CLIENTS</font></a> | <a class=myLink href=\"indexv10.html\"><font face=\"Times New Roman\" color=\"#4a658c\">CORPORATE CLIENTS</font></a> | <a class=myLink href=\"indexv10.html\"><font face=\"Times New Roman\" color=\"#4a658c\">CLIENT DEMOGRAPHICS</font></a> | <a class=myLink href=\"indexv10.html\"><font face=\"Times New Roman\" color=\"#4a658c\">FAQ\\'S</font></a></b></font>\'");
document.write("submenu[3]=\'<font face=\"Times New Roman\" color=\"#4a658c\"><b><a class=myLink href=\"indexv10.html\"><font face=\"Times New Roman\" color=\"#4a658c\">NEWSLETTERS</font></a> | <a class=myLink href=\"indexv10.html\"><font face=\"Times New Roman\" color=\"#4a658c\">PRESS RELEASES</font></a> | <a class=myLink href=\"indexv10.html\"><font face=\"Times New Roman\" color=\"#4a658c\">LINKS</font></a> | <a class=myLink href=\"indexv10.html\"><font face=\"Times New Roman\" color=\"#4a658c\">INVESTMENT READING</font></a></b></font>\'");
document.write("submenu[4]=\'<font face=\"Times New Roman\" color=\"#4a658c\"><b><a class=myLink href=\"indexv10.html\"><font face=\"Times New Roman\" color=\"#4a658c\">GENERAL MAILBOX</font></a> | <a class=myLink href=\"indexv10.html\"><font face=\"Times New Roman\" color=\"#4a658c\">YOUR ADVISOR</font></a></b></font>\'");
document.write("//Set delay before submenu disappears after mouse moves out of it (in milliseconds)");
document.write("var delay_hide=0");
document.write("//No need to edit beyond here");
document.write("var menuobj=document.getElementById? document.getElementById(\"describe\") : document.all? document.all.describe : document.layers? document.dep1.document.dep2 : \"\"");
document.write("function showit(which){");
document.write("clear_delayhide()");
document.write("thecontent=(which==-1)? \"\" : submenu[which]");
document.write("if (document.getElementById||document.all)");
document.write("menuobj.innerHTML=thecontent");
document.write("else if (document.layers){");
document.write("menuobj.document.write(thecontent)");
document.write("menuobj.document.close()");
document.write("}");
document.write("}");
document.write("function resetit(e){");
document.write("if (document.all&&!menuobj.contains(e.toElement))");
document.write("delayhide=setTimeout(\"showit(-1)\",delay_hide)");
document.write("else if (document.getElementById&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))");
document.write("delayhide=setTimeout(\"showit(-1)\",delay_hide)");
document.write("}");
document.write("function clear_delayhide(){");
document.write("if (window.delayhide)");
document.write("clearTimeout(delayhide)");
document.write("}");
document.write("function contains_ns6(a, b) {");
document.write("while (b.parentNode)");
document.write("if ((b = b.parentNode) == a)");
document.write("return true;");
document.write("return false;");
document.write("}");
document.write("</script>");
document.write("</td>");
document.write("</tr>");
document.write("</Table>");
document.write("</TD>");
document.write("</TR>");
document.write("</TABLE>");
document.write("</BODY>");
document.write("</HTML>");
and im calling it from the html file using:
<Script language="javascript" src="pageend4.js"></script>
thanks
tzaf