NameSilo

JavaScript rollover problem

SpaceshipSpaceship
SpaceshipSpaceship
Spacemail by SpaceshipSpacemail by Spaceship
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
Close
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
Close
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
Close
Thanks guys! 'tworks :D
 
0
Close
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
Close
AIVikingsAIVikings

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

New: watch any domain
You can now watch domains on NamePros. We check each one and notify you when something changes. Search for a domain and press Watch on...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back