JavaScript rollover problem

SpaceshipSpaceship
Watch

TyR

Established Member
Impact
1
hi, im trying to create a neat little script that displays a text inside a div, heres what i have so far:

PHP:
<div id="pie">Latest Tutorials</div>

<a href="#" onmouseout="hidetmb()" onmouseover="showtmb('Hello World')"><img src="someicon.png"></a>
<a href="#" onmouseout="hidetmb()" onmouseover="showtmb('w00t')"><img src="someicon.png"></a>
<a href="#" onmouseout="hidetmb()" onmouseover="showtmb('a spoon')"><img src="someicon.png"></a>

<script language="JavaScript">
<!--

function showtmb(texty){
    this.pie.innerHTML = texty;
}
function hidetmb(){
    this.pie.innerHTML = "Latest Tutorials";
}
-->
</script>

It works fine in internet explorer, but I cant get it to work in FireFox :/ any ideas?
 
Last edited:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Hmm... Try this:
HTML:
<script language="JavaScript">
<!--

function showtmb(texty)
{
  document.getElementById('pie').innerHTML = texty;
}
function hidetmb()
{
  document.getElementById('pie').innerHTML = "Latest Tutorials";
}
// -->
</script>
 
Last edited:
0
•••
Code:
<div id="pie">Latest Tutorials</div>

<a href="#" onmouseout="hidetmb()" onmouseover="showtmb('Hello World')"><img src="someicon.png"></a>
<a href="#" onmouseout="hidetmb()" onmouseover="showtmb('w00t')"><img src="someicon.png"></a>
<a href="#" onmouseout="hidetmb()" onmouseover="showtmb('a spoon')"><img src="someicon.png"></a>

<script language="JavaScript">
function showtmb(texty){
    document.getElementById('pie').innerHTML = texty;
}
function hidetmb(){
    document.getElementById('pie').innerHTML = "Latest Tutorials";
}
</script>

BTW, what does <!-- and --> do inside of the script?

edit: It works; I just tested it.
 
0
•••
Thanks guys! 'tworks :D
 
0
•••
Dan Friedman said:
BTW, what does <!-- and --> do inside of the script?
It supposedly hides Javascript from older browsers. It is essentially outdated now, since the use of older browsers (browsers not supporting javascript) in web terms are ancient and non-existant today.



Although I did play around with NS4 the other day :p
Very poor CSS support at best.

-Steve
 
0
•••
Appraise.net

We're social

Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomainEasy — Live Options
DomDB
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back