Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

show hide script

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, I'm wanting to code a "mouseover" type script that when the mouse goes over a specific "spot"..say an image or a thumbnail or even a number. In a totatally different section on the page the referred image appears. I think I've explained that right.

I've seen on some sites that do this, have in the script "showhide" im not sure if that is what this trick is called, but I would appreciate a code for this. thanks
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
it is done with layers.....
here is the basic code
<html>
<head>
<script>

function ShowIt(how,wlayer){
if (document.getElementById) {
document.getElementById(wlayer).style.visibility = how;
}
else if (document.all) {
document.all[wlayer].style.visibility = how;
}
else if (document.layers) {
document.layers[wlayer].visibility = how;
}
}
</script>
<title>A1ien51's DHTML Advert</title>
</head>
<div id="ADVERT" style="position: absolute; z-index: 5; top:100; left:100; width:100; height:100; background:#ffff00; visibility:hidden">
<p>This is the layers text</p>
</div>
<div id="TheText" style="position: absolute; z-index: 5; top:400; left:100; width:100; height:100; background:#ffff00; visibility:hidden">
<p>Smile, The code is easy to play with</p>
</div>
<a href="http://www10.brinkster.com/A1ien51" onmouse_over="ShowIt('visible','ADVERT')" onmouse_out="ShowIt('hidden','ADVERT')">Mouse Over Me Please</a>
<a href="http://www10.brinkster.com/A1ien51" onmouse_over="ShowIt('visible','TheText')" onmouse_out="ShowIt('hidden','TheText')">Mouse Over Me Please</a>
</html>
make sure to take thelines out of the mouse_over and mouse_out
 
Seriously? That's what you're going with? I prefer this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic