473,326 Members | 2,061 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,326 software developers and data experts.

Single popop menu attached to multiple images

I need to create a popup with items (small, medium, large) and attach
it to a whole bunch of images.
Its the same menus for all images. menus should popup around the point
on the image where it was
clicked.
can someone send me a little sample code to do this ?

do i have to create a new popup for my 100s of images ? or would i
create only one and
attach it to an event with x,y coordinates and popup the only one menu
there ?

Please help.

any code sample is highly appreciated.

Feb 24 '06 #1
1 1170
Hi MelHer...,

You dont need to create 100s of popups.
Is the popup supposed to be shown in a new window or as a layer??

I assume that you are looking to display it in a layer and that layer
has to popup according to the users mouse position when they pass their
mouse over image. Is that right?

If what I understood was right, go through the code below.. Or else
skip this reply :)

<SCRIPT language="javascript">
ns_xml=(document.layers);
ymouse_xml =0;
xmouse_xml =0;
function Mouse_xml(evnt_xml){
ymouse_xml = ((ns_xml)?evnt_xml.pageY-(window.pageYOffset):event.y);
// ymouse_xml = screenY
xmouse_xml = (ns_xml)?evnt_xml.pageX:event.x;
}

function findElemPosX(obj_xml)
{
var curleft_xml = 0;
if (obj_xml.offsetParent)
{
while (obj_xml.offsetParent)
{
curleft_xml += obj_xml.offsetLeft
obj_xml = obj_xml.offsetParent;
}
}
else if (obj_xml.x)
curleft_xml += obj_xml.x;
return curleft_xml;
alert(curleft_xml)
}

function findElemPosY(obj_xml)
{
var curtop_xml = 0;
if (obj_xml.offsetParent)
{
while (obj_xml.offsetParent)
{
curtop_xml += obj_xml.offsetTop
obj_xml = obj_xml.offsetParent;
}
}
else if (obj_xml.y)
curtop_xml += obj_xml.y;
return curtop_xml;
}
function ElemMouse_xml( elem )
{
if( elem )
{
xmouse_xml = findElemPosX( elem )
ymouse_xml = findElemPosY( elem )
} else
{
Mouse_xml()
}
}

function display_layer(elem)
{
ElemMouse_xml( elem )
div = document.getElementById( "the_id_of_the_popup" )
div.style.visibility = 'visible'
div.style.left = xmouse_xml
div.style.top = ymouse_xml
}
</SCRIPT>

Now call the display_layer( elem ) function. (Here elem is the id of
the image) It gives you the x and y coordinates of the calling image.
Make sure to use different IDs for all the image elements and set the
property of the popup to hidden.

Hope that this helps.

Pls mind my naming convention in the above code. As I had to diaply
more complex layers, I had to use wierd naming conventions..

Chaitu..

Feb 24 '06 #2

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

Similar topics

4
by: JesusFreak | last post by:
From: us_traveller@yahoo.com (JesusFreak) Newsgroups: microsoft.public.scripting.jscript Subject: toolbar script problem NNTP-Posting-Host: 192.92.126.136 Recently, I downloaded the following...
9
by: amitavabardhan | last post by:
How Can I extract multiple tiff images into single images through asp programming? Is there any free dll's that I can use in ASP to split multiple tiffs into single tiffs? Any suggestion...
2
by: RWD | last post by:
I am trying to figure out how to change the target frame in my hyperlink on a DHTML menu. The menu is in one frame and the target frame is called "main" The code is below: Thanks in advance...
4
by: Yuk Cheng | last post by:
<<<start index.htm>>> <html> <head> <script> function perform(action){ } </script> </head>
4
by: Lynn Morrison | last post by:
I cannot find this feature at all. There is no bitmap property for menu items nor is there an imagelist property for the menu itself... How do I put images to the left of menu items? Thanks, ...
0
by: Mel | last post by:
I need to create a popup with items (small, medium, large) and attach it to a whole bunch of images. Its the same menus for all images. menus should popup around the point on the image where it...
3
by: CD | last post by:
An application is logging faxes sent in SQL2000 image column type. I have found code on the net but what it is doing is prompting to save to local which is fine for single page image. Not good...
2
by: pagates | last post by:
Hi All, I have an issue where I'd like a single global event to be handled by multiple event handlers. In this case, I would like a "global" (static) Menu Item that I create in a class, and I'd...
35
by: keerthyragavendran | last post by:
hi i'm downloading a single file using multiple threads... how can i specify a particular range of bytes alone from a single large file... for example say if i need only bytes ranging from...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.