473,396 Members | 1,898 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,396 software developers and data experts.

Javascript- I need a thumbnail to be displayed when mouseover text...?

I have a list of items... And i want a little thumbnail of each item to be displayed when the mouse is over a particular text ...
Say if i have a list of fruits i want an apple thumbnail on the corner of the text when am over it... and a banana when am over the banana..
Hope yall get the question.. Workin on a webpage any help would be great.. thx in advance
Here`s wat ive got so far... it opens only 1 thumbnail which ive predefined in the script.. can ne 1 temme .. how i can u se this script to call a particular image on a particular mouseover text event....

<script>
<!--
var thumb = null;
function showThumbnail(which,e)
{
thumb = document.getElementById('thumb');
if( thumb && thumb.style.visibility == 'hidden' )
{
thumb.style.left = e.pageX ? pageXOffset + e.clientX + 80 : document.body.scrollLeft + e.x - 15;
thumb.style.top = e.pageY ? pageYOffset + e.clientY : document.body.scrollTop + e.y + 20;
thumb.style.visibility = 'visible';
thumb.innerHTML = '<img src="' + which + '">';
}
}
function closeThumbnail()
{
if( thumb )
thumb.style.visibility = 'hidden';
}
-->
</script>

<div id="thumb" style="position: absolute; visibility: hidden; border: 1px solid black"></div>


I call the function like this:-

<A Href=http://www.google.com target='_blank' onmouseover="showThumbnail('http://www.myserver.com/images/t1140107714orangerecplayer.jpg', event)" onmouseout="closeThumbnail()" > My Text link</A>
Jul 11 '07 #1
1 1681
acoder
16,027 Expert Mod 8TB
Just change the src of the image instead:
Expand|Select|Wrap|Line Numbers
  1. imgObj.src='newimage.gif';
You could define an array which contains your thumbnails and access them using the indices.
Jul 11 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

17
by: Ian | last post by:
Hi there, Can anybody tell me where I can find a standards documents like you have in c#. I am trying to write javascript and would like to know what standards are i.e. Where to put the...
14
by: Rich | last post by:
I am converting my enterprise solution from VS 2003 (.NET v1.1.4322) to VS 2005 (.NET v2.0.50727). The entire solution uses serveral technologies - Windows Server 2003 (AD, SQL Server 2000, IIS,...
104
by: Leszek | last post by:
Hi. Is it possible in javascript to operate on an array without knowing how mamy elements it has? What i want to do is sending an array to a script, and this script should add all values from...
18
by: Tom Cole | last post by:
I'm working on a small Ajax request library to simplify some tasks that I will be taking on shortly. For the most part everything works fine, however I seem to have some issues when running two...
10
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - Which newsgroups deal with javascript? ----------------------------------------------------------------------- ...
12
by: pantagruel | last post by:
Hi, I'm thinking of making a WScript based JavaScript library, I can think of some specific non-browser specific scripting examples that should probably make it in, like Crockford's little...
84
by: Patient Guy | last post by:
Which is the better approach in working with Javascript? 1. Server side processing: Web server gets form input, runs it into the Javascript module, and PHP collects the output for document prep....
19
by: maya | last post by:
hi, so what is "modern" javascript?? the same as "DOM-scripting"? i.e., editing content (or changing appearance of content) dynamically by massaging javascript objects, html elements, etc? ...
34
by: dhtml | last post by:
I made a change to the FAQ of javascript to EcmaScript. I got some feedback that the newsgroup is CLJ and the language is commonly referred to as JavaScript. Therefore, the word in the FAQ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.