PDA

View Full Version : Creating a Menu Script--error


doni
11-10-2002, 03:42 AM
I downloaded HotMetaL Pro today. I included a JS menu creator. I thought I'd give it a try and see if it would work with frames any better than HV Menu.

However everytime the page loads, I get an error message 'isFrames' is undefined. What I don't understand is that it says that the error is character 1 on line 21.

Line 21 contains nothing but separatorCol = "#FFFF00";.

Thanks.



<SCRIPT LANGUAGE="JavaScript" SRC="JavaScript/hierMenus.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
NS4 = (document.layers);
IE4 = (document.all);
ver4 = (NS4 || IE4);
isMac = (navigator.appVersion.indexOf("Mac") != -1);
isMenu = (NS4 || (IE4 && !isMac));
function popUp(){return};
function popDown(){return};
function startIt(){return};
if (!ver4) event = null;

if (isMenu) {
menuVersion = 3;
menuWidth = 120;
borWid = 2;
borSty = "solid";
borCol = "black";
separator = 1;
separatorCol = "#FFFF00";
fntFam = "sans-serif";
fntBold = true;
fntItal = false;
fntSiz = 10;
fntCol = "#FFFFFF";
overFnt = "#0000FF";
itemPad = 3;
backCol = "#0000FF";
overCol = "#FFFFFF";
imgSrc = "tri.gif";
imgSiz = 10;

childOffset = 5;
childOverlap = 50;
perCentOver = null;

clickStart = false;
clickKill = false;
secondsVisible = 0.5;

keepHilite = false;
NSfontOver = false;

isFrames = true;
navFrLoc = "left";
mainFrName = "main";
}
//-->
</SCRIPT>

doni
11-11-2002, 03:25 AM
No ideas from the experts here?

glenngv
11-11-2002, 07:42 AM
the error is in hierMenus.js which you didn't post.
Undefined error means that you use a variable that has not been defined yet. I saw you set isFrames to true in the script you posted but maybe it is used in the external js with no value yet.

doni
11-11-2002, 01:45 PM
Originally posted by glenngv
the error is in hierMenus.js which you didn't post.
Undefined error means that you use a variable that has not been defined yet. I saw you set isFrames to true in the script you posted but maybe it is used in the external js with no value yet.

I'll have to check when I get home, but I'm pretty sure the external JS files are NOT run until after the script that I posted has been run. However, I'll post the other files as well.

doni
11-11-2002, 11:11 PM
It'll be in three seperate posts do to message size limits (one message per file).

Thanks.

The Navigation Page:

<!DOCTYPE HTML PUBLIC "-//SoftQuad Software//DTD HoTMetaL PRO 6.0::19990601::extensions to HTML 4.0//EN" "hmpro6.dtd">
<HTML>
<HEAD><SCRIPT LANGUAGE="JavaScript"> NS4 = (document.layers);
IE4 = (document.all);
ver4 = (NS4 || IE4);
isMac = (navigator.appVersion.indexOf("Mac") != -1);
isMenu = (NS4 || (IE4 && !isMac));
function popUp(){return};
function popDown(){return};
function startIt(){return};
if (!ver4) event = null;

isFrames = true;
if (isMenu) {
menuVersion = 3;
menuWidth = 120;
borWid = 2;
borSty = "solid";
borCol = "black";
separator = 1;
separatorCol = "#FFFF00";
fntFam = "sans-serif";
fntBold = true;
fntItal = false;
fntSiz = 10;
fntCol = "#FFFFFF";
overFnt = "#0000FF";
itemPad = 3;
backCol = "#0000FF";
overCol = "#FFFFFF";
imgSrc = "tri.gif";
imgSiz = 10;

childOffset = 5;
childOverlap = 50;
perCentOver = null;

clickStart = false;
clickKill = false;
secondsVisible = 0.5;

keepHilite = false;
NSfontOver = false;

navFrLoc = "left";
mainFrName = "main";
}
//-->
</SCRIPT> <SCRIPT LANGUAGE="JavaScript1.2">
<!--
if (isMenu) {
document.write("<SCRIPT LANGUAGE='JavaScript1.2' SRC='hierArrays.js'><\/SCRIPT>");
document.write("<SCRIPT LANGUAGE='JavaScript1.2' SRC='hierMenus.js'><\/SCRIPT>");
}
//-->
</SCRIPT> <SCRIPT>
/*
Live Date Script-
© Dynamic Drive (www.dynamicdrive.com)
For full source code, installation instructions, 100's more DHTML scripts, and Terms Of Use,
visit http://www.dynamicdrive.com
*/


var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")

function getthedate(){
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var hours=mydate.getHours()
var minutes=mydate.getMinutes()
var seconds=mydate.getSeconds()
var dn="AM"
if (hours>=12)
dn="PM"
if (hours>12){
hours=hours-12
}
if (hours==0)
hours=12
if (minutes<=9)
minutes="0"+minutes
if (seconds<=9)
seconds="0"+seconds
//change font size here
var cdate=hours+":"+minutes+":"+seconds+" "+dn + "<br>" + dayarray[day]+", "+montharray[month]+" "+daym+", "+year
if (document.all)
document.all.clock.innerHTML=cdate
else if (document.getElementById)
document.getElementById("clock").innerHTML=cdate
else
document.write(cdate)
}
if (!document.all&&!document.getElementById)
getthedate()
function goforit(){
if (document.all||document.getElementById)
setInterval("getthedate()",1000)
}

</SCRIPT>
<TITLE>Navigation</TITLE>
<LINK REL="stylesheet" TYPE="text/css" HREF="StyleSheets/NavStyle.css">
</HEAD>
<BODY ONLOAD="goforit()">
<NOSCRIPT>
<P><A HREF="PlaceAdefaultLinkForOldBrowsersHere.html"
ONMOUSEOVER="popUp('elMenu1',event)" ONMOUSEOUT="popDown('elMenu1')">
Appropriate Displayed Text for this Link/Menu</A></P>
<P><A HREF="PlaceAdefaultLinkForOldBrowsersHere.html"
ONMOUSEOVER="popUp('elMenu2',event)" ONMOUSEOUT="popDown('elMenu2')">
Appropriate Displayed Text for this Link/Menu</A></P>
<P><A HREF="PlaceAdefaultLinkForOldBrowsersHere.html"
ONMOUSEOVER="popUp('elMenu3',event)" ONMOUSEOUT="popDown('elMenu3')">
Appropriate Displayed Text for this Link/Menu</A></P>
<P><A HREF="PlaceAdefaultLinkForOldBrowsersHere.html"
ONMOUSEOVER="popUp('elMenu4',event)" ONMOUSEOUT="popDown('elMenu4')">
Appropriate Displayed Text for this Link/Menu</A></P></NOSCRIPT> <STYLE>
p.clock
{
position: absolute;
bottom: 20px
}
</STYLE>
<P CLASS="clock"> <SPAN ID="clock"></SPAN></P> </BODY>
</HTML>

doni
11-11-2002, 11:12 PM
hierArray.js

/** It is recommended that the arrays
be saved as an external file. Start CUT here. **/
arMenu1 = new Array(
"",
"","",
"","",
"","",
"","",
"Home","home.html",0
);
arMenu2 = new Array(
"",
"","",
"","",
"","",
"","",
"Resume","resume.html",1
);

arMenu2_1 = new Array(
"Resume in PDF Format","resume.pdf",0,
"Download Free Adobe PDF Reader","http://www.adobe.com/products/acrobat/readstep.html",0
);
arMenu3 = new Array(
"",
"","",
"","",
"","",
"","",
"Services","services.html",1
);

arMenu3_1 = new Array(
"Web Design","wwwdesign.html",0,
"Web Hosting","wwwhosting.html",0,
"Custom Programming","programming.html",0
);
arMenu4 = new Array(
"",
"","",
"","",
"","",
"","",
"EMail Me","mailt" + "o:Don Ireland<r" + "di@w" + "riteme.com>",0
);

arMenu4_1 = new Array(
"Email Me","mailt" + "o:Don Ireland<r" + "di@w" + "riteme.com>",0,
"Display Text for Item 2","Link URL for Item 2",0
);

doni
11-11-2002, 11:15 PM
hierMenus.js

This file still was to big to post as a message, so I've attached it as a file.

doni
11-11-2002, 11:25 PM
OK--I just looked once again. One of the menu files IS loaded before the variables are set.

I fixed that problem and the error message is gone.

However, the menu still doesn't show up.

Posted the file online at this location (http://mywebpages.comcast.net/doni49/navtest.html)

Thanks for taking the time to try and help.

The JS files have NOT changed, but I edited my post above to reflect the way the HTML page NOW looks.

glenngv
11-12-2002, 01:06 AM
you have this in the main page:

function popUp(){return};
function popDown(){return};
function startIt(){return};

and also in the external hiermenus.js

why do you have those empty functions?

doni
11-12-2002, 01:51 AM
Originally posted by glenngv
you have this in the main page:

function popUp(){return};
function popDown(){return};
function startIt(){return};

and also in the external hiermenus.js

why do you have those empty functions?

I don't know what they do or why they're blank. This is code the program created. It's not working properly and I was hoping to get some help fixing it.

The reason I say it's not working is that the menu is not displayed. Just on the off chance that it had anything to do with the fact that I've been testing it by loading the Nav page by itself, I loaded the other pages. You can see them in frames mode at Frames Test (http://mywebpages.comcast.net/doni49/indextest.html).

Thanks your efforts.

glenngv
11-12-2002, 01:58 AM
remove those empty functions because you already have them in the external js.

doni
11-13-2002, 03:32 AM
Originally posted by glenngv
remove those empty functions because you already have them in the external js.

OK I REMOVED all three lines (didn't comment them out--physically removed them). When I loaded the page, I got an error "Object not found". When I put the three lines back, the error went away.