Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

onmouseover javascript for a submenu

Posted on 2001-08-18
3
Medium Priority
?
469 Views
Last Modified: 2006-11-17
Why is my onmouseover javascript for a submenu not working?

1cell gave me a script for my needs.  I got it to work, but then I started putting in most of my info, links, font color,etc.  I added another javascipt to the page and it still worked so that must not be it.  I think when I was typing in my info it messed something up and I just can't see it.  Will someone be willing to take a look at it and see if you can see why it won't work. 1cell?

<HTML>
<!--This file created 1:58 AM  8/19/01 by Claris Home Page version 3.0-->
<HEAD>
   <TITLE>default4</TITLE>
   <META NAME=GENERATOR CONTENT="Claris Home Page 3.0">
   <X-CLARIS-WINDOW TOP=21 BOTTOM=443 LEFT=21 RIGHT=718>
   <X-CLARIS-REMOTESAVE SERVER="209.96.106.4" USER="Sharon Godiska" DIR="/ehwebserver/Web Folder/" FILE="">
   <X-CLARIS-TAGVIEW MODE=minimal>
<script><!--

var content=new Array()
/*change the array below to the links associated with menu links Expand or contract the array, depending
on how many menus you have*/
content[0]='<b>Administration</b><br><a href="admin.html">A Message from Mr. Kressly, our Principal.</a>'
content[1]='<b>Current Events</b><br><a href="chupdate.html">Charger Update</a><br><a href="calendar.html">District Calendar</a><br><a href="jkressly.html">EHMS Calendar</a>'
content[2]='<b>HW and Team Info.</b><br><a href="team_info/team6G.html">Team 6G</a><br><a href="team_info/team6H.html">Team 6H</a><br><a href="team_info/team6L.html">Team 6L</a><br><a href="team_info/team6P.html">Team 6P</a><br><a href="team_info/team6T.html">Team 6T</a><br><a href="team_info/team6Z.html">Team 6Z</a><br><a href="team_info/team7H.html">Team 7H</a><br><a href="team_info/team7M.html">Team 7M</a><br><a href="team_info/team7NQ.html">Team 7NQ</a><br><a href="team_info/team7R.html">Team 7R</a><br><a href="team_info/team8D.html">Team 8D</a><br><a href="team_info/team8J.html">Team 8J</a><br><a href="team_info/team8M.html">Team 8M</a><br><a href="team_info/team8P.html">Team 8P</a><br><a href="team_info/EAP_ESOL.html">EAP/ESOL</a><a href="team_info/related_arts.html">Related Arts</a><br><a href="team_info/seminar.html">Seminar</a><br><a href="team_info/spec_ed.html">Special Education</a>'
content[3]='<b>Organizations</b><br><a href="band.html">Band and Orchestra Organization</a><br><a href="EHPA/EHPA_main.htm">Parent Association</a>'
content[4]='<b>Resources</b><br><a href="links.html">Curriculum Resources</a><br><a href="link2.html">Faculty/Staff</a><br><a href="link3.html">Library</a><br><a href="phone.html">Phone Numbers</a><br><a href="link5.html">The Standards</a>'
content[5]='<b>Special Programs</b><br><a href="harmonium.html">Harmonium</a><br><a href="link2.html">Monagacci</a><br><a href="link3.html">Nature Quest</a><br><a href="spiritbeth.html">Spirit of Bethlehem</a>'
content[6]='<b>Student Services</b><br><a href="activities.html">Activities</a><br><a href="guidance.html">Guidance</a><br><a href="sports.html">Interscholastic sports</a><br><a href="intramurals.html">Intramurals</a>'
content[7]='<b>Site Map</b><br><a href="sitemap.html">If you don't see what you are looking for click here for our site map.</a>'

function recreate(){
window.location.reload()
}
function recreate2(){
if (document.layers){
appear()
setTimeout("window.onresize=recreate",450)
}
}

function changeMenu(whichMenu){

if (document.all||document.getElementById){
cross_el=document.getElementById? document.getElementById("descriptions"):document.all.descriptions
cross_el.innerHTML=whichMenu
}
else if (document.layers){
document.first.document.second.document.write('<font face="Verdana">'+whichMenu+'</font>')
document.first.document.second.document.close()
}

}

function appear(){
document.first.visibility='show'
}

window.onload=recreate2


//--></script>
</HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#800000" VLINK="#808080" BACKGROUND="images/ehbkgrd.gif">
<P><TABLE BORDER=0 WIDTH=610>
   <TR>
      <TD WIDTH=30>
         <P></P>
      </TD>
      <TD VALIGN=top WIDTH=566>
         <P><IMG SRC="images/ehmstitle2.jpg" WIDTH=550 HEIGHT=144 X-CLARIS-USEIMAGEWIDTH X-CLARIS-USEIMAGEHEIGHT ALIGN=bottom></P>
      </TD>
   </TR>
   <TR>
      <TD WIDTH=30>
         <P></P>
      </TD>
      <TD WIDTH=566>
         <P></P>
      </TD>
   </TR>
</TABLE>
 <TABLE BORDER=0 WIDTH=610>
   <TR>
      <TD WIDTH=30>
         <P></P>
      </TD>
      <TD WIDTH=135>
         <CENTER>&nbsp;</CENTER>
         
         <P><div id="scriptmenu" style="line-height:20px"> <A HREF="#" onmouseover="changeMenu(content[0])"><FONT COLOR="#660033">Administration</FONT></A><FONT COLOR="#660033"><BR>
         </FONT> <A HREF="#" onmouseover="changeMenu(content[1])"><FONT COLOR="#660033">Current
         Events</FONT></A> <FONT COLOR="#660033"><BR>
         </FONT> <A HREF="#" onmouseover="changeMenu(content[2])"><FONT COLOR="#660033">HW
         &amp; Team Info.</FONT></A> <FONT COLOR="#660033"><BR>
         </FONT> <A HREF="#" onmouseover="changeMenu(content[3])"><FONT COLOR="#660033">
         Organizations</FONT></A><FONT COLOR="#660033"><BR>
         </FONT> <A HREF="#" onmouseover="changeMenu(content[4])"><FONT COLOR="#660033">Resources</FONT></A><FONT COLOR="#660033"><BR>
         </FONT> <A HREF="#" onmouseover="changeMenu(content[5])"><FONT COLOR="#660033">Special
         Programs</FONT></A><FONT COLOR="#660033"><BR>
         </FONT> <A HREF="#" onmouseover="changeMenu(content[6])"><FONT COLOR="#660033">Student
         Services</FONT></A><FONT COLOR="#660033"><BR>
         </FONT> <A HREF="#" onmouseover="changeMenu(content[7])"><FONT COLOR="#660033">Site
         Map</FONT></A><FONT COLOR="#660033"><BR>
         </FONT></div></P>
      </TD>
      <TD WIDTH=151>
         <CENTER><TABLE BORDER=0>
            <TR>
               <TD BACKGROUND="images/initials2.gif" HEIGHT=275>
                  <P>&nbsp;</P>
                 
                  <CENTER><ilayer id="first" width="200" height="200" visibility="hide">
<layer id="second" width="200" height="200"> <div id="descriptions" align="left">
                  <!--Change below to default menu--></CENTER>
                 
                  <H2><CENTER><FONT COLOR="#800000">An Experience in
                  Excellence</FONT></CENTER></H2>
                 
                  <CENTER><!--Stop editting--> </div> </layer> </ilayer></CENTER>
               </TD>
            </TR>
         </TABLE>
         </CENTER>
      </TD>
      <TD WIDTH=325>
         <P><SCRIPT LANGUAGE=JavaScript><!--

/*
Script by FPMC at http://jsarchive.8m.com
Submitted to Website Abstraction (http://wsabstract.com)
For this and 400+ free scripts, visit http://wsabstract.com
*/

//set image paths
src = ["images/1.jpg", "images/2.jpg", "images/3.jpg", "images/4.jpg"]


//set corresponding urls
url = ["http://freewarejava.com", "http://wsabstract.com", "http://dynamicdrive.com", "http://www.geocities.com"]

//set duration for each image
duration = 4;

//Please do not edit below
ads=[]; ct=0;
function switchAd() {
var n=(ct+1)%src.length;
if (ads[n] && (ads[n].complete || ads[n].complete==null)) {
document["Ad_Image"].src = ads[ct=n].src;
}
ads[n=(ct+1)%src.length] = new Image;
ads[n].src = src[n];
setTimeout("switchAd()",duration*1000);
}
function doLink(){
location.href = url[ct];
} onload = function(){
if (document.images)
switchAd();
}
//--></SCRIPT> <A HREF="javascript:doLink();" onmouseover="status=url[ct];return true;" onmouseout="status=''">
         <IMG SRC="images/1.jpg" WIDTH=253 HEIGHT=253 X-CLARIS-USEIMAGEWIDTH X-CLARIS-USEIMAGEHEIGHT BORDER=0 ALIGN=bottom name="Ad_Image">
         </A></P>
         
         <CENTER><FONT SIZE="-2" FACE="arial">This free script
         provided by </FONT><A HREF="http://wsabstract.com"><FONT SIZE="-2" FACE="arial">Website
         Abstraction</FONT></A></CENTER>
      </TD>
   </TR>
   <TR>
      <TD WIDTH=30>
         <P></P>
      </TD>
      <TD WIDTH=135>
         <P></P>
      </TD>
      <TD WIDTH=151>
         <P></P>
      </TD>
      <TD WIDTH=325>
         <P></P>
      </TD>
   </TR>
</TABLE>
</P>
</BODY>
</HTML>
0
Comment
Question by:maddy007
3 Comments
 
LVL 1

Accepted Solution

by:
gordonmcmullan earned 1200 total points
ID: 6403024
Hi,

in the following line

content[7]='<b>Site Map</b><br><a href="sitemap.html">If you don't see what you are looking for click here for our site map.</a>';

you have an unescaped apostrophe the line should read

content[7]='<b>Site Map</b><br><a href="sitemap.html">If you don\'t see what you are looking for click here for our site map.</a>';

notice the backslash before the apostrophe in don't.

You are using the same characther to terminate your strings so need to escape it in this way if you want to also use the character within your string.

hope this helps

Gordon McMullan
0
 
LVL 1

Expert Comment

by:Y_ee
ID: 6403043
gordonmcmullan is right I found the same problem here is how it should be

content[7]='<b>Site Map</b><br><a href="sitemap.html">If you don\'t see what you are looking for click here for our site map.</a>'

if you don't escape you are cutting the string and that causes the error

ciao
Y
0
 

Author Comment

by:maddy007
ID: 6403628
Thank you both of you.  I can't believe I didn't notice that myself.  I should have.  I have been using html for about 3 years now and teach my students it,too.  We know that one quote left out of an a href will destroy the link.  Anyway, thank you. thank you. thank you.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question