473,387 Members | 1,541 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Rollovers in Mozilla

Hi,

I have the following function...

function display(subject) {
var topic="";
var chapter="";
var assignment="";
if (subject=="HTML") {
topic="HTML";
chapter="1-6";
assignment="1";
}
else if (subject=="DHTML") {
topic="DHTML";
chapter="11-15";
assignment="6-8";
}

var topicName=document.getElementById("topic");
var newTopic=document.createTextNode(topic);
topicName.replaceChild(newTopic, topicName.childNodes[0]);

var chapterName=document.getElementById("chapter");
var newChapter=document.createTextNode(chapter);
chapterName.replaceChild(newChapter, chapterName.childNodes[0]);

var assignmentName=document.getElementById("assignment ");
var newAssignment=document.createTextNode(assignment);
assignmentName.replaceChild(newAssignment, assignmentName.childNodes[0]);
}

....which is called in the following:

<table>
<tr>
<a href="#" onMouseOver='display("HTML")'><td>HTML</td></a>
<a href="#" onMouseOver='display("DHTML")'><td>DHTML</td></a>
</tr>
</table>
<ul>
<li><h4>Topic: </h4><span id="topic">HTML Review</span></li>
<li><h4>Chapters: </h4><span id="chapter">1-6</span></li>
<li><h4>Assignments: </h4><span id="assignment">1</span></li>
</ul>

This works great in IE6, but does nothing in Mozilla browsers. Does
anyone see the problem here?

Thanks,
Aaron
Jul 23 '05 #1
2 1082
Aaron wrote:
<table>
<tr>
<a href="#" onMouseOver='display("HTML")'><td>HTML</td></a>
<a href="#" onMouseOver='display("DHTML")'><td>DHTML</td></a>


Here is your problem... It needs to be changed to:

<td><a href="#" onMouseOver='display("HTML")'>HTML</a></td>
<td><a href="#" onMouseOver='display("DHTML")'>DHTML</a></td>

See, it doesnt make sense to have an anchor tag in a TR tag. Only table
cells may be in a TR tag (TD, or TH).

Why does IE do it? Because they will parse any non-standard HTML code,
even if it doesnt make sense. It creates a world of non-compliance that
annoys a lot of people.

Brian

Jul 23 '05 #2


Aaron wrote:
I have the following function...

function display(subject) {
var topic="";
var chapter="";
var assignment="";
if (subject=="HTML") {
topic="HTML";
chapter="1-6";
assignment="1";
}
else if (subject=="DHTML") {
topic="DHTML";
chapter="11-15";
assignment="6-8";
}

var topicName=document.getElementById("topic");
var newTopic=document.createTextNode(topic);
topicName.replaceChild(newTopic, topicName.childNodes[0]);

var chapterName=document.getElementById("chapter");
var newChapter=document.createTextNode(chapter);
chapterName.replaceChild(newChapter, chapterName.childNodes[0]);

var assignmentName=document.getElementById("assignment ");
var newAssignment=document.createTextNode(assignment);
assignmentName.replaceChild(newAssignment,
assignmentName.childNodes[0]);
}
When I stuff that function into a <script> element in the head of a HTML
page and see below
...which is called in the following:

<table>
<tr>
<a href="#" onMouseOver='display("HTML")'><td>HTML</td></a>
<a href="#" onMouseOver='display("DHTML")'><td>DHTML</td></a>
and correct the markup to properly have the <a> elements inside of <td>
elements e.g.

<td><a href="#" onMouseOver='display("HTML")'>HTML</a></td>
<td><a href="#" onMouseOver='display("DHTML")'>DHTML</a></td> </tr>
</table>
<ul>
<li><h4>Topic: </h4><span id="topic">HTML Review</span></li>
<li><h4>Chapters: </h4><span id="chapter">1-6</span></li>
<li><h4>Assignments: </h4><span id="assignment">1</span></li>
</ul>

This works great in IE6, but does nothing in Mozilla browsers. Does
anyone see the problem here?


then I don't have any problem here with Netscape 7.1, onmouseover the
text nodes are changed.

You might even not use the <a> element at all but directly use
<td onmouseover="..."
instead.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Lorne Cameron | last post by:
I've put together a rough copy of what will be my site's menu bar, but I'm not sure if I've done the rollovers correctly (I got the code from HTMLcodetutorial.com I think). Check the look and code...
4
by: Kanuf | last post by:
On a page I am designing, I'm trying to create a "div rollover". Basically, I want a div's contents to change (or a new div to replace the old one) via hover. I have tried this, but it doesn't...
15
by: Applebrown | last post by:
I've got a couple of errors on my site that I'm not sure how to fix. I'm using simple CSS for both text rollovers and my horizontal navbar, and here's what happens. First, the site: ...
3
by: gallery | last post by:
I also cross-posted this in comp.infosystems.www.authoring.html. I think it's more appropriate here. I read somewhere that you can get Tim Murtaugh's Mo' Betta Rollovers to work in Firefox using...
10
by: idiotprogrammer | last post by:
Hi, there, I'm trying to do something, and part of the problem is that I don't know how to describe the effect. One block will have a list of links stacked over one another and separated by p...
2
by: Frances Del Rio | last post by:
Hi, I while back I was having a problem with rollovers, even though I do them in a very conventional way: function roll(i) { document.src = eval(i + "_roll.src") } // in which value passed...
3
by: Shahid Juma | last post by:
Hi, Is it possible to do roll overs over an area of an image. I know you can setup up a hotspot but can a roll over be done on that particular hotsop. Additionally, when the image changes on the...
2
by: Frances Del Rio | last post by:
I have a form in which submit button is an img.. would like to do it w/a rollover, but can't get rollover to work.. can you do rollovers w/img submit buttons? this is code I have: <input...
3
by: Norman Swartz | last post by:
Rollovers on a web page I created were instantaneous on my computer when the page was loaded directly from my hard drive, but were painfully slow when loaded from the web. However, on another...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
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,...
0
jinu1996
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.