Solved

Mouseover error in mozilla

Posted on 2003-11-03
10
569 Views
Last Modified: 2006-11-17
I have a piece of javascript that performs a style change on mouseover and a function onclick.
It works perfectly in IE (5+) yet i get this error in mozilla: "Error: m_over is not defined",
"Error: go is not defined" and "Error: m_out is not defined".
These are the functions:

function m_over(src) {
 src.style.textDecoration = 'underline';
 src.style.cursor = 'hand';
}
function go(what) {
 alert(what+"\n\nnormally you can do something here");
}

called using this html code:
<td id="htl" onclick="go('home');" onmouseover="m_over(this);" onmouseout="m_out(this);">

It works perfectly in IE, yet it simply does nothing in mozilla. I have not tested this in netscape.
0
Comment
Question by:dabazza
  • 7
  • 2
10 Comments
 
LVL 12

Expert Comment

by:ahosang
ID: 9673498
I have to say it works for me in Moz, so please give us a link to your page or show a stripped version of code.
Also, it's cursor='pointer', NOT cursor='hand'

<html>
<head>

<script>
function m_over(src) {
 src.style.textDecoration = 'underline';
 src.style.cursor = 'pointer';
}
function m_out(src) {
  src.style.textDecoration='none';
  src.style.cursor='default';
}
function go(what) {
 alert(what+"\n\nnormally you can do something here");
}
</script>
</head>

<body>
<span id="htl" onclick="go('home');" onmouseover="m_over(this);" onmouseout="m_out(this)">hello there</span>
</body>
</html>
0
 
LVL 16

Expert Comment

by:jaysolomon
ID: 9673516
Where is your m_out function?

everything works except the m_out function.i assume it reverts m_over back to the original state
0
 
LVL 16

Expert Comment

by:jaysolomon
ID: 9673527
sorry ahosang

Did not reload question
0
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 

Author Comment

by:dabazza
ID: 9673564
Best I could do is to upload a stripped down version to http://v6.n-12.net/test.html
0
 
LVL 16

Accepted Solution

by:
jaysolomon earned 125 total points
ID: 9673617
Change this

<script language="JScript">

to this

<script type="text/javascript">

0
 
LVL 16

Expert Comment

by:jaysolomon
ID: 9673628
also you need to add this

<html>
<head>
<script type="text/javascript">
//Your scripts here

</script>
</head>
<body>
<!-- Content Here -->
</body>
</html>
0
 
LVL 16

Expert Comment

by:jaysolomon
ID: 9673640
Lastly here the whole page fixed (not valid HTML)

<html>
<head>
<script type="text/javascript">
<!--
function m_over(src) {
 src.style.textDecoration = 'underline';
 src.style.cursor = 'pointer';
}
function m_out(src) {
 src.style.textDecoration = 'none';
}
function go(what) {
 alert(what+"\n\nnormally you can do something here");
}
// -->
</script>

</head>
<body>
<div align="center">
  <center>

<table border="0" cellpadding="0" cellspacing="0" style="border-style:solid; border-width: 1px; border-color:#000000; padding:0; border-collapse: collapse" bordercolor="#111111" width="90%">
  <tr>
    <td colspan="2" background="background_header.bmp" height="61" align="left" valign="bottom" style="padding: -1px">
    <img border="0" src="nav%20left.bmp"><br></td>  </tr>
  <tr>

    <td width="100%" colspan="2" background="top_nav_header.bmp" height="35" valign="top">
    <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="40%" height="35" id="top_nav_tab">
      <tr>
        <td width="32%" id="htl" onclick="go('home');" onmouseover="m_over(this);" onmouseout="m_out(this);">
        <p align="center"><b><span style="font-variant: small-caps">
        <font face="Verdana" color="#8D98A9" size="2">home</font></span></b></td>
        <td width="1%">
        <img border="0" src="top_nav_spacer.bmp" width="5" height="35"></td>

        <td width="32%" id="stl" onclick="go('scripts');" onmouseover="m_over(this);"onmouseout="m_out(this);">
        <p align="center"><b><span style="font-variant: small-caps">
        <font face="Verdana" color="#8D98A9" size="2">scripts</font></span></b></td>
        <td width="1%">
        <img border="0" src="top_nav_spacer.bmp" width="5" height="35"></td>
        <td width="32%" id="mtl" onclick="go('media');" onmouseover="m_over(this);">
        <p align="center"><b><span style="font-variant: small-caps">
        <font face="Verdana" color="#8D98A9" size="2">media</font></span></b></td>

        <td width="1%">
        <img border="0" src="top_nav_spacer.bmp" width="5" height="35"></td>
      </tr>
    </table>
    </td>
  </tr>
  <tr>
    <td width="174" background="nav_repeat_left.bmp" height="1" valign="top"><img src="blank.gif" width="175" height="1"></td>
    <td width="99%" height="1"></td>

  </tr>
  <tr>
    <td width="174" background="nav_repeat_left.bmp" height="300" valign="top">
    <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber2">
      <tr>
        <td width="11%"><img border="0" src="icons/home.bmp" width="16" height="16"></td>
        <td width="89%">
    <font face="Verdana" size="2" color="#3366CC">
    <span style="font-variant: small-caps; font-weight: 700">home</span></font></td>

      </tr>
      <tr>
        <td width="11%">
<img border="0" src="icons/php.bmp" width="16" height="16"></td>
        <td width="89%">
    <b><span style="font-variant: small-caps">
    <font face="Verdana" color="#3366CC" size="2">php</font></span></b></td>
      </tr>
      <tr>

        <td width="11%">&nbsp;</td>
        <td width="89%">&nbsp;</td>
      </tr>
    </table>
    <p align="left">&nbsp;<p align="left">&nbsp;
    <font face="Verdana" size="2" color="#3366CC">
    <span style="font-variant: small-caps; font-weight: 700"><br>
    <br>
    </span>

    <br>
    <img border="0" src="spacer.bmp" width="175" height="3"></span></font><br>
<span style="padding-left: 18px; font-variant: small-caps; font-weight: 700">&nbsp;</span></td>
    <td width="99" valign="top">&nbsp;</td>
  </tr>
  <tr>
    <td width="100%" background="base_repeat.bmp" colspan="2" height="35">&nbsp;</td>
  </tr>
</table></center>
</div>
0
 
LVL 16

Expert Comment

by:jaysolomon
ID: 9673644
sorry typo

add this to the end

</body>
</html>
0
 

Author Comment

by:dabazza
ID: 9673667
Brilliant, thanks for clearing that all up for me, now it all runs perfectly in Mozilla. (had to accept the higher up answer as it was the main fix)
0
 
LVL 16

Expert Comment

by:jaysolomon
ID: 9673692
Glad we could help, and thanks

jAy
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
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…

777 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