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> 10 2020
Ok, I've looked at what's happening and I think I have narrowed down the
problem. The main "frames.htm l" creates the left-hand frame with the menu
on it. The first menu loads correctly because the page is being loades from
scratch, but the second page doesn't. I can't spot a difference in the page
code (copied below for info) so I can only assume some sort of refresh is
needed.
If anybody could tell me if I'm on the right lines I'd really appreciate it,
Thanks,
John
Html Follows:
----------------
The following code works:
<html><head onLoad="top.eva lImage(1)","top .evalImage(8)">
<TITLE>Welcom e to John Ortts Internet Page - Contents Menu</TITLE>
</head><body bgcolour="white ">
<P><A target=Left
onclick="top.ab outmemenu();top .amcount()"
onmouseout="top .evalImage(1)"
onmouseover="to p.evalRollon(1) ">
<img src="About Me.gif" alt="About Me" width=250 height=50 border=0
name="about"></A>
</P><P><A href="top.proje cts()" target=Left
onclick="top.pr ojectsmenu();to p.projectcount( )"
onmouseout="top .evalImage(8)"
onmouseover="to p.evalRollon(8) ">
<img src="Projects.g if" alt="Projects" width=250 height=50 border=0
name="projects" ></A>
</P>
</body></html>
This code doesn't buit is essentially the same:
<html><head
onLoad="top.eva lImage(98)","to p.evalImage(2)" ,"top.evalImage (4)">
<TITLE>Welcom e to John Ortts Internet Page - About Me Menu</TITLE>
</head><body bgcolour="white ">
<P><A target=Left
onclick="top.ma inMenu();top.up onecount()"
onmouseout="top .evalImage(98)"
onmouseover="to p.evalRollon(98 )"
onLoad="top.eva lImage(98)" return="false">
<img src=top.evalIma ge(98) alt="Up" width=250 height=50 border=0
name="up"></A>
</P><P><A href="mycv.html " target=Right
onclick="top.cv count()"
onmouseout="top .evalImage(2)"
onmouseover="to p.evalRollon(2) "
onLoad=top.eval Image(2) return="false">
<img src="top.evalIm age(2)" alt="My CV" width=250 height=50 border=0
name="cv"></A>
</P>
</body></html>
Not when that url is on an Intranet,
(and I don't have webspace outside the company).
"Andrew Thompson" <Se********@www .invalid> wrote in message
news:32******** *************** *****@40tude.ne t... On Fri, 16 Jul 2004 10:35:56 +0100, John Ortt wrote:
Code Follows:
You do realize that a single URL would have been more effective and over 400 lines shorter than the post you made?
-- Andrew Thompson http://www.PhySci.org/ Open-source software suite http://www.PhySci.org/codes/ Web & IT Help http://www.1point1C.org/ Science & Technology
On Fri, 16 Jul 2004 16:36:30 +0100, John Ortt wrote: (and I don't have webspace outside the company).
GeoCities.. (It's a big internet)
Alternatively, if 'the company' is serious about
solving the problem, why are they not prepared to
throw a couple of bucks out for getting a short
term 'testing' site?
[ And if the company is *not* serious about
solving the problem, it begs the question of
why you expect random strangers to care. ]
--
Andrew Thompson http://www.PhySci.org/ Open-source software suite http://www.PhySci.org/codes/ Web & IT Help http://www.1point1C.org/ Science & Technology
John Ortt said: This code doesn't buit is essentially the same:
Since the difference is that the images don't load,
the obvious place to focus is the "src" attributes
of the <img> tags.
In the following (non-working) code, you're trying
to assign Javascript variables as src attributes.
You can't mix Javascript and HTML like that:
<html><head onLoad="top.ev alImage(98)","t op.evalImage(2) ","top.evalImag e(4)"> <TITLE>Welco me to John Ortts Internet Page - About Me Menu</TITLE> </head><body bgcolour="white "> <P><A target=Left onclick="top.m ainMenu();top.u ponecount()" onmouseout="to p.evalImage(98) " onmouseover="t op.evalRollon(9 8)" onLoad="top.ev alImage(98)" return="false"> <img src=top.evalIma ge(98) alt="Up" width=250 height=50 border=0 name="up"></A> </P><P><A href="mycv.html " target=Right onclick="top.c vcount()" onmouseout="to p.evalImage(2)" onmouseover="t op.evalRollon(2 )" onLoad=top.eva lImage(2) return="false"> <img src="top.evalIm age(2)" alt="My CV" width=250 height=50 border=0 name="cv"></A> </P> </body></html>
John Ortt said: I have created a Javascript menu for my site which uses frames.
You could cut your code about in half by using "switch"
statements in place of the "if"s. There are even better
ways to do this, that don't involve passing numeric codes.
Please get rid of the series of functions that each increment
a single global variable.
Your call to the function:
function uponecount()
{++up_1}
can be replaced by:
top.up_1++
Thanks for the info Andrew.
I didn't know there were places offering free webspace. I will try to put
it on the GeoCities website later on in the week and repost.
I will also try to include some of the tips Lee gave me to shorten the code.
The site is essentially a personnal homepage for me on the company intranet
(They have an area set aside for the employees).
It is intended to tell people what I do and how I do it and gives links to
the department.
For this reason it isn't business critical and there is no way the company
are going to release funding for me to develop it :(
But I would like to get it working if possible just to improve my knowledge
of the subject.
Thanks again,
John
"Andrew Thompson" <Se********@www .invalid> wrote in message
news:f1******** *************** ******@40tude.n et... On Fri, 16 Jul 2004 16:36:30 +0100, John Ortt wrote:
(and I don't have webspace outside the company).
GeoCities.. (It's a big internet)
Alternatively, if 'the company' is serious about solving the problem, why are they not prepared to throw a couple of bucks out for getting a short term 'testing' site?
[ And if the company is *not* serious about solving the problem, it begs the question of why you expect random strangers to care. ]
-- Andrew Thompson http://www.PhySci.org/ Open-source software suite http://www.PhySci.org/codes/ Web & IT Help http://www.1point1C.org/ Science & Technology
On Mon, 19 Jul 2004 11:15:09 +0100, John Ortt wrote: I didn't know there were places offering free webspace. I will try to put it on the GeoCities website later on in the week and repost.
I will also try to include some of the tips Lee gave me to shorten the code.
That is a good idea. I wrote a page on just how
much it can help to shorten and simplify code.
The article is more focused on Java (a different
language to JS) but I feel you might find some
valuable tips in it in any case..
<http://www.physci.org/codes/sscce.jsp>
But I would like to get it working if possible just to improve my knowledge of the subject.
People who are trying to improve their knowledge
are very welcome on this group, especially if
they have displayed that they can benefit from
the advice they receive.
Continue reading the froup and you may spot the
answer to your problem, but if you simplify your
code and still do not get the problem sorted, post
it to GeoCities and make a new post on this thread
with the URL.
I am confident someone will be able to spot the error.
--
Andrew Thompson http://www.PhySci.org/ Open-source software suite http://www.PhySci.org/codes/ Web & IT Help http://www.1point1C.org/ Science & Technology This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: JesusFreak |
last post by:
From: us_traveller@yahoo.com (JesusFreak)
Newsgroups: microsoft.public.scripting.jscript
Subject: toolbar script problem
NNTP-Posting-Host: 192.92.126.136
Recently, I downloaded the following beautiful script
"http://javascript.internet.com/navigation/toolbar-menu.html". It
works like a charm. I made my webpage in frames, where the nav-frame
shows the menubar, so whenever I click a link in the menubar, it opens
in the frame below. But...
|
by: John Ortt |
last post by:
Hi everyone, I posted with the title "Javascript Menu Not Loading Images"
last week but I only posted the code as the site was on a corporate
Intranet.
Thanks to advice on the thread I have created a Geocities page. I have also
cleaned up the code slightly (again thanks to a few tips).
The problem should be evident when you open up the link, but I will include
the original text after the link. (A link to the original thread would be...
|
by: John Ortt |
last post by:
I appologise for reposting this but I have been trying to find a solution
all week with no avail and I was hoping a repost might help somebody more
knowledgable than myself to spot the message...
I am trying to write a webpage in Javascript. The page loads with three
frames, a top, left and right frame.
Depending on the users actions the background page rewrites the code for the
relevant frames.
|
by: jimmygoogle |
last post by:
I posted earlier with a scope problem. I think I resolved it in IE but
in Firefox it still exists. Anyone have any ideas/experience with
this? I attached my code sorry it is so long. You can cut/paste it
into 2 files and run it to see what I mean.
###############menu.html###############
<html>
<body>
<script type="text/javascript">
|
by: tim |
last post by:
I am using foldoutmenu 3 and am having problems with viewing my menus
in firefox. On my sub3 menus i have more than one line of text in some
places. firefox does not recognise that there is more than one line
and the text simply overlaps the sub-menus below it. I thought i had
got around this by placing empty 'spacers' like so;
oFoldMenu.make('sub3','')//spacer
unfortunately, i have just viewed the site in IExplorer and it has
added...
| |
by: sindhu |
last post by:
Hello,
I want to use Images as menu and menu items using javascript.The aim is that i have images with the menu items. when i click the image on that perticular mmenu item i want an image to be loaded there with that menu item highlighted.
Suppose the menu has
Home,Products,Contact us
The image has these items.
When the user clicks Home , i want the Image with Home highlighted to be loaded. when the user clicks Contact Us, The image with...
|
by: CKich30 |
last post by:
When viewing my page (siuehockey.net) in Firefox, it's setup how I want it to look. When i viewed it using IE, the menu at the top runs into the "Cougar Hockey/cougarhockey.net" at the top left. It's leaving off two menu selections: Contact, and Cougar History, which when loading the page get covered up by the banner picture.
Here's the CSS for the site:
body {
margin: 0;
padding: 0;
background: #000000 url(images/img01.jpg)...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |