Hi Everyone,
I have created a Javascript menu for my site which uses frames. The first
stage loads fine but I want two drill down menus ("About Me Menu" and
"Projects Menu"). The pages load fine, but the images aren't displayed,
instead the alt text is shown. The images come up after you "Mouse Over"
them but not before......can anybody spot any errors in my code which could
be doing this please. For info, I have 4 images for each button, to take
into acount whether the button had been used and to give a mouse-over image
for each state. I have also deleted the code for items 3-5 as they are
commercially sensitive.
Thanks in Advance,
John
Code Follows:
-----------------
<html>
<head>
<title>Welcom e to John's Homepage</title>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=is o-8859-1">
<title>Welcom e to John's Internet Site</title>
<SCRIPT language=javasc ript type=text/javascript>
<!-- Hide Me
if (top.location != self.location) {top.location = self.location}
if (document.image s)
{
up = new Array("Up.gif", "UpF.gif","UpP. gif","UpFP.gif" );
aboutMe = new Array("About Me.gif","About MeF.gif","About MeP.gif","About
MeFP.gif");
myCv = new Array("My CV.gif","My CVF.gif","My CVP.gif","My CVFP.gif");
javaScript = new
Array("Javascri pt.gif","Javasc riptF.gif","Jav ascriptP.gif"," JavascriptFP.gi f
");
photos = new
Array("Photos.g if","PhotosF.gi f","PhotosP.gif ","UPhotosFP.gi f");
projects = new
Array("Projects .gif","Projects F.gif","Project sP.gif","Projec tsFP.gif");
wallPapers = new
Array("Wallpape r.gif","Wallpap erF.gif","Wallp aperP.gif","Wal lpaperFP.gif");
var up_1=0
var up_2=0
var about_me=0
var my_cv=0
var java_script=0
var photos_1=0
var projects_1=0
var wall_papers=0
}
else
{
up = "";
document.up = "";
aboutMe = "";
document.aboutm e = "";
myCV = "";
document.myCV = "";
javaScript= "";
document.javaSc ript = "";
photos = "";
document.photos = "";
projects = "";
document.projec ts = "";
wallPapers = "";
document.wallPa pers = "";
}
function evalRollon(item )
{
if (item==98)
if (up_1==0)
{ Left.up.src=up[1] }
else
{ Left.up.src=up[3] }
}
if (item==99)
if (up_2==0)
{ Left.up.src=up[1] }
else
{ Left.up.src=up[3] }
}
if (item==1)
{
if (about_me==0)
{ Left.about.src= aboutMe[1] }
else
{ Left.about.src= aboutMe[3] }
}
if (item==2)
if (my_cv==0)
{ Left.cv.src=myC v[1] }
else
{ Left.cv.src=myC v[3] }
}
if (item==6)
if (java_script==0 )
{ Left.java.src=j avaScript[1] }
else
{ Left.java.src=j avaScript[3] }
}
if (item==7)
if (photos_1==0)
{ Left.photos.src =photos[1] }
else
{ Left.photos.src =photos[3] }
}
if (item==8)
if (projects_1==0)
{ Left.projects.s rc=projects[1] }
else
{ Left.projects.s rc=projects[3] }
}
if (item==9)
if (wall_papers==0 )
{ Left.wallpapers .src=wallPapers[1] }
else
{ Left.wallpapers .src=wallPapers[3] }
}
}
function evalImage(item)
{
if (item==98)
if (up_1==0)
{ Left.up.src=up[0] }
else
{ Left.up.src=up[2] }
}
if (item==99)
if (up_2==0)
{ Left.up.src=up[0] }
else
{ Left.up.src=up[2] }
}
if (item==1)
{
if (about_me==0)
{ Left.about.src= aboutMe[0] }
else
{ Left.about.src= aboutMe[2] }
}
if (item==2)
if (my_cv==0)
{ Left.cv.src=myC v[0] }
else
{ Left.cv.src=myC v[2] }
}
if (item==6)
if (java_script==0 )
{ Left.java.src=j avaScript[0] }
else
{ Left.java.src=j avaScript[2] }
}
if (item==7)
if (photos_1==0)
{ Left.photos.src =photos[0] }
else
{ Left.photos.src =photos[2] }
}
if (item==8)
if (projects_1==0)
{ Left.projects.s rc=projects[0] }
else
{ Left.projects.s rc=projects[2] }
}
if (item==9)
if (wall_papers==0 )
{ Left.wallpapers .src=wallPapers[0] }
else
{ Left.wallpapers .src=wallPapers[2] }
}
}
function uponecount()
{++up_1}
function uptwocount()
{++up_2}
function amcount()
{++about_me}
function cvcount()
{++my_cv}
function javacount()
{++java_script}
function photocount()
{++photos_1}
function projectcount()
{++projects_1}
function wallcount()
{++wall_paper}
function mainMenu()
{
parent.Left.doc ument.close()
parent.Left.doc ument.open()
parent.Left.doc ument.writeln(' <html><head
onLoad="top.eva lImage(1)","top .evalImage(8)"> ')
parent.Left.doc ument.writeln(" <TITLE>Welcom e to Johns Internet Page -
Contents Menu</TITLE>")
parent.Left.doc ument.writeln(' </head><body bgcolour="white ">')
parent.Left.doc ument.writeln(' <P><A target=Left')
parent.Left.doc ument.writeln(' onclick="top.ab outmemenu();top .amcount()"')
parent.Left.doc ument.writeln(' onmouseout="top .evalImage(1)"' )
parent.Left.doc ument.writeln(' onmouseover="to p.evalRollon(1) ">')
parent.Left.doc ument.writeln(' <img src="About Me.gif" alt="About Me"
width=250 height=50 border=0 name="about"></A>')
parent.Left.doc ument.writeln(' </P><P><A href="top.proje cts()"
target=Left')
parent.Left.doc ument.writeln(' onclick="top.pr ojectsmenu();to p.projectcount( )
"')
parent.Left.doc ument.writeln(' onmouseout="top .evalImage(8)"' )
parent.Left.doc ument.writeln(' onmouseover="to p.evalRollon(8) ">')
parent.Left.doc ument.writeln(' <img src="Projects.g if" alt="Projects"
width=250 height=50 border=0 name="projects" ></A>')
parent.Left.doc ument.writeln(' </P>')
parent.Left.doc ument.writeln(" </body></html>")
}
function aboutmemenu()
{
parent.Left.doc ument.close()
parent.Left.doc ument.open()
parent.Left.doc ument.writeln(' <html><head
onLoad="top.eva lImage(98)","to p.evalImage(2)" ,"top.evalImage (4)">')
parent.Left.doc ument.writeln(" <TITLE>Welcom e to Johns Internet Page - About
Me Menu</TITLE>")
parent.Left.doc ument.writeln(' </head><body bgcolour="white ">')
parent.Left.doc ument.writeln(' <P><A target=Left')
parent.Left.doc ument.writeln(' onclick="top.ma inMenu();top.up onecount()"')
parent.Left.doc ument.writeln(' onmouseout="top .evalImage(98)" ')
parent.Left.doc ument.writeln(' onmouseover="to p.evalRollon(98 )"')
parent.Left.doc ument.writeln(' onLoad="top.eva lImage(98)" return="false"> ')
parent.Left.doc ument.writeln(' <img src=top.evalIma ge(98) alt="Up" width=250
height=50 border=0 name="up"></A>')
parent.Left.doc ument.writeln(' </P><P><A href="mycv.html " target=Right')
parent.Left.doc ument.writeln(' onclick="top.cv count()"')
parent.Left.doc ument.writeln(' onmouseout="top .evalImage(2)"' )
parent.Left.doc ument.writeln(' onmouseover="to p.evalRollon(2) "')
parent.Left.doc ument.writeln(' onLoad=top.eval Image(2) return="false"> ')
parent.Left.doc ument.writeln(' <img src="top.evalIm age(2)" alt="My CV"
width=250 height=50 border=0 name="cv"></A>')
parent.Left.doc ument.writeln(' </P>')
parent.Left.doc ument.writeln(" </body></html>")
}
up = new Array("Up.gif", "UpF.gif","UpP. gif","UpFP.gif" );
aboutMe = new Array("About Me.gif","About MeF.gif","About MeP.gif","About
MeFP.gif");
myCv = new Array("My CV.gif","My CVF.gif","My CVP.gif","My CVFP.gif");
javaScript = new
Array("Javascri pt.gif","Javasc riptF.gif","Jav ascriptP.gif"," JavascriptFP.gi f
");
photos = new
Array("Photos.g if","PhotosF.gi f","PhotosP.gif ","UPhotosFP.gi f");
projects = new
Array("Projects .gif","Projects F.gif","Project sP.gif","Projec tsFP.gif");
wallPapers = new
Array("Wallpape r.gif","Wallpap erF.gif","Wallp aperP.gif","Wal lpaperFP.gif");
function projectsmenu()
{
parent.Left.doc ument.close()
parent.Left.doc ument.open()
parent.Left.doc ument.writeln(" <html><head>" )
parent.Left.doc ument.writeln(" <TITLE>Welcom e to Johns Internet Page - About
Me Menu</TITLE>")
parent.Left.doc ument.writeln(' </head><body bgcolour="white ">')
parent.Left.doc ument.writeln(' <P><A target=Left')
parent.Left.doc ument.writeln(' onclick="top.ma inMenu();top.up twocount()"')
parent.Left.doc ument.writeln(' onmouseout="top .evalImage(99)" ')
parent.Left.doc ument.writeln(' onmouseover="to p.evalRollon(99 )"')
parent.Left.doc ument.writeln(' onLoad="top.eva lImage(99)" return="false"> ')
parent.Left.doc ument.writeln(' <img src="top.evalIm age(99)" alt="Up"
width=250 height=50 border=0 name="up"></A>')
parent.Left.doc ument.writeln(' </P><P><A href="javascrip t.html"
target=Right')
parent.Left.doc ument.writeln(' onclick="top.ja vacount()"')
parent.Left.doc ument.writeln(' onmouseout="top .evalImage(6)"' )
parent.Left.doc ument.writeln(' onmouseover="to p.evalRollon(6) "')
parent.Left.doc ument.writeln(' onLoad="top.eva lImage(6)" return="false"> ')
parent.Left.doc ument.writeln(' <img src="top.evalIm age(6)" alt="Java"
width=250 height=50 border=0 name="java"></A>')
parent.Left.doc ument.writeln(' </P><P><A href="Photos.ht ml" target=Right')
parent.Left.doc ument.writeln(' onclick="top.ph otocount()"')
parent.Left.doc ument.writeln(' onmouseout="top .evalImage(7)"' )
parent.Left.doc ument.writeln(' onmouseover="to p.evalRollon(7) "')
parent.Left.doc ument.writeln(' onLoad="top.eva lImage(7)" return="false"> ')
parent.Left.doc ument.writeln(' <img src="top.evalIm age(7)" alt="Java"
width=250 height=50 border=0 name="photos"></A>')
parent.Left.doc ument.writeln(' </P><P><A href="wallpaper s.html"
target=Right')
parent.Left.doc ument.writeln(' onclick="top.wa llcount()"')
parent.Left.doc ument.writeln(' onmouseout="top .evalImage(9)"' )
parent.Left.doc ument.writeln(' onmouseover="to p.evalRollon(9) "')
parent.Left.doc ument.writeln(' onLoad="top.eva lImage(9)" return="false"> ')
parent.Left.doc ument.writeln(' <img src="top.evalIm age(9)" alt="Wallpapers "
width=250 height=50 border=0 name="wallpaper s"></A>')
parent.Left.doc ument.writeln(' </P>')
parent.Left.doc ument.writeln(" </body></html>")
}
// Stop Hiding Me. -->
</SCRIPT>
</head>
<frameset rows="80,*" framespacing="0 " border="0" frameborder="NO ">
<frame src="Top.html" name="Top" noresize>
<frameset cols="250,*" framespacing="0 " border="0" frameborder="NO "
onload="mainMen u()">
<frame name="Left" noresize>
<frame src="Right.html " name="Right" noresize>
</frameset>
</frameset>
<noframes>
<body>
</body>
</noframes>
</html>
I have created a Javascript menu for my site which uses frames. The first
stage loads fine but I want two drill down menus ("About Me Menu" and
"Projects Menu"). The pages load fine, but the images aren't displayed,
instead the alt text is shown. The images come up after you "Mouse Over"
them but not before......can anybody spot any errors in my code which could
be doing this please. For info, I have 4 images for each button, to take
into acount whether the button had been used and to give a mouse-over image
for each state. I have also deleted the code for items 3-5 as they are
commercially sensitive.
Thanks in Advance,
John
Code Follows:
-----------------
<html>
<head>
<title>Welcom e to John's Homepage</title>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=is o-8859-1">
<title>Welcom e to John's Internet Site</title>
<SCRIPT language=javasc ript type=text/javascript>
<!-- Hide Me
if (top.location != self.location) {top.location = self.location}
if (document.image s)
{
up = new Array("Up.gif", "UpF.gif","UpP. gif","UpFP.gif" );
aboutMe = new Array("About Me.gif","About MeF.gif","About MeP.gif","About
MeFP.gif");
myCv = new Array("My CV.gif","My CVF.gif","My CVP.gif","My CVFP.gif");
javaScript = new
Array("Javascri pt.gif","Javasc riptF.gif","Jav ascriptP.gif"," JavascriptFP.gi f
");
photos = new
Array("Photos.g if","PhotosF.gi f","PhotosP.gif ","UPhotosFP.gi f");
projects = new
Array("Projects .gif","Projects F.gif","Project sP.gif","Projec tsFP.gif");
wallPapers = new
Array("Wallpape r.gif","Wallpap erF.gif","Wallp aperP.gif","Wal lpaperFP.gif");
var up_1=0
var up_2=0
var about_me=0
var my_cv=0
var java_script=0
var photos_1=0
var projects_1=0
var wall_papers=0
}
else
{
up = "";
document.up = "";
aboutMe = "";
document.aboutm e = "";
myCV = "";
document.myCV = "";
javaScript= "";
document.javaSc ript = "";
photos = "";
document.photos = "";
projects = "";
document.projec ts = "";
wallPapers = "";
document.wallPa pers = "";
}
function evalRollon(item )
{
if (item==98)
if (up_1==0)
{ Left.up.src=up[1] }
else
{ Left.up.src=up[3] }
}
if (item==99)
if (up_2==0)
{ Left.up.src=up[1] }
else
{ Left.up.src=up[3] }
}
if (item==1)
{
if (about_me==0)
{ Left.about.src= aboutMe[1] }
else
{ Left.about.src= aboutMe[3] }
}
if (item==2)
if (my_cv==0)
{ Left.cv.src=myC v[1] }
else
{ Left.cv.src=myC v[3] }
}
if (item==6)
if (java_script==0 )
{ Left.java.src=j avaScript[1] }
else
{ Left.java.src=j avaScript[3] }
}
if (item==7)
if (photos_1==0)
{ Left.photos.src =photos[1] }
else
{ Left.photos.src =photos[3] }
}
if (item==8)
if (projects_1==0)
{ Left.projects.s rc=projects[1] }
else
{ Left.projects.s rc=projects[3] }
}
if (item==9)
if (wall_papers==0 )
{ Left.wallpapers .src=wallPapers[1] }
else
{ Left.wallpapers .src=wallPapers[3] }
}
}
function evalImage(item)
{
if (item==98)
if (up_1==0)
{ Left.up.src=up[0] }
else
{ Left.up.src=up[2] }
}
if (item==99)
if (up_2==0)
{ Left.up.src=up[0] }
else
{ Left.up.src=up[2] }
}
if (item==1)
{
if (about_me==0)
{ Left.about.src= aboutMe[0] }
else
{ Left.about.src= aboutMe[2] }
}
if (item==2)
if (my_cv==0)
{ Left.cv.src=myC v[0] }
else
{ Left.cv.src=myC v[2] }
}
if (item==6)
if (java_script==0 )
{ Left.java.src=j avaScript[0] }
else
{ Left.java.src=j avaScript[2] }
}
if (item==7)
if (photos_1==0)
{ Left.photos.src =photos[0] }
else
{ Left.photos.src =photos[2] }
}
if (item==8)
if (projects_1==0)
{ Left.projects.s rc=projects[0] }
else
{ Left.projects.s rc=projects[2] }
}
if (item==9)
if (wall_papers==0 )
{ Left.wallpapers .src=wallPapers[0] }
else
{ Left.wallpapers .src=wallPapers[2] }
}
}
function uponecount()
{++up_1}
function uptwocount()
{++up_2}
function amcount()
{++about_me}
function cvcount()
{++my_cv}
function javacount()
{++java_script}
function photocount()
{++photos_1}
function projectcount()
{++projects_1}
function wallcount()
{++wall_paper}
function mainMenu()
{
parent.Left.doc ument.close()
parent.Left.doc ument.open()
parent.Left.doc ument.writeln(' <html><head
onLoad="top.eva lImage(1)","top .evalImage(8)"> ')
parent.Left.doc ument.writeln(" <TITLE>Welcom e to Johns Internet Page -
Contents Menu</TITLE>")
parent.Left.doc ument.writeln(' </head><body bgcolour="white ">')
parent.Left.doc ument.writeln(' <P><A target=Left')
parent.Left.doc ument.writeln(' onclick="top.ab outmemenu();top .amcount()"')
parent.Left.doc ument.writeln(' onmouseout="top .evalImage(1)"' )
parent.Left.doc ument.writeln(' onmouseover="to p.evalRollon(1) ">')
parent.Left.doc ument.writeln(' <img src="About Me.gif" alt="About Me"
width=250 height=50 border=0 name="about"></A>')
parent.Left.doc ument.writeln(' </P><P><A href="top.proje cts()"
target=Left')
parent.Left.doc ument.writeln(' onclick="top.pr ojectsmenu();to p.projectcount( )
"')
parent.Left.doc ument.writeln(' onmouseout="top .evalImage(8)"' )
parent.Left.doc ument.writeln(' onmouseover="to p.evalRollon(8) ">')
parent.Left.doc ument.writeln(' <img src="Projects.g if" alt="Projects"
width=250 height=50 border=0 name="projects" ></A>')
parent.Left.doc ument.writeln(' </P>')
parent.Left.doc ument.writeln(" </body></html>")
}
function aboutmemenu()
{
parent.Left.doc ument.close()
parent.Left.doc ument.open()
parent.Left.doc ument.writeln(' <html><head
onLoad="top.eva lImage(98)","to p.evalImage(2)" ,"top.evalImage (4)">')
parent.Left.doc ument.writeln(" <TITLE>Welcom e to Johns Internet Page - About
Me Menu</TITLE>")
parent.Left.doc ument.writeln(' </head><body bgcolour="white ">')
parent.Left.doc ument.writeln(' <P><A target=Left')
parent.Left.doc ument.writeln(' onclick="top.ma inMenu();top.up onecount()"')
parent.Left.doc ument.writeln(' onmouseout="top .evalImage(98)" ')
parent.Left.doc ument.writeln(' onmouseover="to p.evalRollon(98 )"')
parent.Left.doc ument.writeln(' onLoad="top.eva lImage(98)" return="false"> ')
parent.Left.doc ument.writeln(' <img src=top.evalIma ge(98) alt="Up" width=250
height=50 border=0 name="up"></A>')
parent.Left.doc ument.writeln(' </P><P><A href="mycv.html " target=Right')
parent.Left.doc ument.writeln(' onclick="top.cv count()"')
parent.Left.doc ument.writeln(' onmouseout="top .evalImage(2)"' )
parent.Left.doc ument.writeln(' onmouseover="to p.evalRollon(2) "')
parent.Left.doc ument.writeln(' onLoad=top.eval Image(2) return="false"> ')
parent.Left.doc ument.writeln(' <img src="top.evalIm age(2)" alt="My CV"
width=250 height=50 border=0 name="cv"></A>')
parent.Left.doc ument.writeln(' </P>')
parent.Left.doc ument.writeln(" </body></html>")
}
up = new Array("Up.gif", "UpF.gif","UpP. gif","UpFP.gif" );
aboutMe = new Array("About Me.gif","About MeF.gif","About MeP.gif","About
MeFP.gif");
myCv = new Array("My CV.gif","My CVF.gif","My CVP.gif","My CVFP.gif");
javaScript = new
Array("Javascri pt.gif","Javasc riptF.gif","Jav ascriptP.gif"," JavascriptFP.gi f
");
photos = new
Array("Photos.g if","PhotosF.gi f","PhotosP.gif ","UPhotosFP.gi f");
projects = new
Array("Projects .gif","Projects F.gif","Project sP.gif","Projec tsFP.gif");
wallPapers = new
Array("Wallpape r.gif","Wallpap erF.gif","Wallp aperP.gif","Wal lpaperFP.gif");
function projectsmenu()
{
parent.Left.doc ument.close()
parent.Left.doc ument.open()
parent.Left.doc ument.writeln(" <html><head>" )
parent.Left.doc ument.writeln(" <TITLE>Welcom e to Johns Internet Page - About
Me Menu</TITLE>")
parent.Left.doc ument.writeln(' </head><body bgcolour="white ">')
parent.Left.doc ument.writeln(' <P><A target=Left')
parent.Left.doc ument.writeln(' onclick="top.ma inMenu();top.up twocount()"')
parent.Left.doc ument.writeln(' onmouseout="top .evalImage(99)" ')
parent.Left.doc ument.writeln(' onmouseover="to p.evalRollon(99 )"')
parent.Left.doc ument.writeln(' onLoad="top.eva lImage(99)" return="false"> ')
parent.Left.doc ument.writeln(' <img src="top.evalIm age(99)" alt="Up"
width=250 height=50 border=0 name="up"></A>')
parent.Left.doc ument.writeln(' </P><P><A href="javascrip t.html"
target=Right')
parent.Left.doc ument.writeln(' onclick="top.ja vacount()"')
parent.Left.doc ument.writeln(' onmouseout="top .evalImage(6)"' )
parent.Left.doc ument.writeln(' onmouseover="to p.evalRollon(6) "')
parent.Left.doc ument.writeln(' onLoad="top.eva lImage(6)" return="false"> ')
parent.Left.doc ument.writeln(' <img src="top.evalIm age(6)" alt="Java"
width=250 height=50 border=0 name="java"></A>')
parent.Left.doc ument.writeln(' </P><P><A href="Photos.ht ml" target=Right')
parent.Left.doc ument.writeln(' onclick="top.ph otocount()"')
parent.Left.doc ument.writeln(' onmouseout="top .evalImage(7)"' )
parent.Left.doc ument.writeln(' onmouseover="to p.evalRollon(7) "')
parent.Left.doc ument.writeln(' onLoad="top.eva lImage(7)" return="false"> ')
parent.Left.doc ument.writeln(' <img src="top.evalIm age(7)" alt="Java"
width=250 height=50 border=0 name="photos"></A>')
parent.Left.doc ument.writeln(' </P><P><A href="wallpaper s.html"
target=Right')
parent.Left.doc ument.writeln(' onclick="top.wa llcount()"')
parent.Left.doc ument.writeln(' onmouseout="top .evalImage(9)"' )
parent.Left.doc ument.writeln(' onmouseover="to p.evalRollon(9) "')
parent.Left.doc ument.writeln(' onLoad="top.eva lImage(9)" return="false"> ')
parent.Left.doc ument.writeln(' <img src="top.evalIm age(9)" alt="Wallpapers "
width=250 height=50 border=0 name="wallpaper s"></A>')
parent.Left.doc ument.writeln(' </P>')
parent.Left.doc ument.writeln(" </body></html>")
}
// Stop Hiding Me. -->
</SCRIPT>
</head>
<frameset rows="80,*" framespacing="0 " border="0" frameborder="NO ">
<frame src="Top.html" name="Top" noresize>
<frameset cols="250,*" framespacing="0 " border="0" frameborder="NO "
onload="mainMen u()">
<frame name="Left" noresize>
<frame src="Right.html " name="Right" noresize>
</frameset>
</frameset>
<noframes>
<body>
</body>
</noframes>
</html>
Comment