473,396 Members | 1,891 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 onMouseOver Issue

Hi,
I am designing a calender which should display a relevent image onmouseover the link in a div.Suppose if a table has 5 links then 5 different images should be displayed in the the div.Kindly help me out.
I have uploaded the files. Please go through it and suggest me about the modifications needs to be done as per the requirement.
Thanks & Regards in advance
Attached Files
File Type: zip Mycal.zip (49.3 KB, 154 views)
Dec 15 '09 #1
12 2933
Dormilich
8,658 Expert Mod 8TB
use the CSS pseudo-class :hover
Dec 15 '09 #2
pls give a relevant link which has the code
Dec 15 '09 #3
Dormilich
8,658 Expert Mod 8TB
a relevant link
: )
Dec 15 '09 #4
Hello Navin,

Do the following in your code to make it work:

1. Give id to image tag
Expand|Select|Wrap|Line Numbers
  1. <img id="imgPIC"/>

2. Use the below modified javascript function:

Expand|Select|Wrap|Line Numbers
  1. function showImg(picName){    
  2.     document.getElementById('PopUp').style.display='block';
  3.     document.getElementById('imgPIC').src = "pics/" + picName + ".jpg";
  4. }
  5.  
  6. function hideImg(){
  7.     document.getElementById('PopUp').style.display='none';
  8. document.getElementById('imgPIC').src = "";
  9. }

3. Call ShowImg function by passing date as paramter:
Expand|Select|Wrap|Line Numbers
  1. <a href="javascript:void(0)" onMouseOver="showImg('5')"  onMouseOut="hideImg()">5</a></td>

4. And the last and the most important thing... you need to rename your images as dates depending on what image you want to display for that date in DIV.
So for e.g. republic day image should be renamed as 26.jpg
and call showImg function as showImg('26').
And this would display republic day image in DIV.


Hope this helps.

Thanks,
Dec 15 '09 #5
Dormilich
8,658 Expert Mod 8TB
comments

2. the element bearing the id "PopUp" must be block level element (p, div, li, …), otherwise your layout may break.

3. onMouseOver (i.e. attributes in Camel Case) may not be supported by some browsers, use the lowercase attribute onmouseover instead. the same applies to the Javascript event properties (Element.onclick, etc.)
Dec 15 '09 #6
First of all Many Many Thanks for your support. I have implemented your idea and made my entire application ready and it is working fine now.
Another small issue related to the same application, now i am using absolute position for the DIV PopUp. Is it possible to make this as relatvie position according to the screen height & width?Also Dynamically change the DIV
bgcolor.Is it possible?
- Cheers
Dec 17 '09 #7
Dormilich
8,658 Expert Mod 8TB
Is it possible to make this as relatvie position according to the screen height & width?
according to my resource, you can use percentage units.
Also Dynamically change the DIV bgcolor. Is it possible?
sure, change the backgroundColor property as desired.
Dec 17 '09 #8
Now i am able to change background color property.Need some help on positioning DIV according to the mouse position.
Dec 17 '09 #9
Now I could manage the position of the DIV also. Finally one more thing , can we provide multiple image type(.jpg/.gif) facility for this application. If it is what are the changes we need to make?
Dec 17 '09 #10
Dormilich
8,658 Expert Mod 8TB
HTML does not care about image types. all it needs is a valid URL to the image.
Dec 18 '09 #11
I agree with your point. In this case we are hardcoding ".jpg". If I want to include .gif/.bmp what change need to be done in js file
Dec 18 '09 #12
Dormilich
8,658 Expert Mod 8TB
include the file extension in the picture’s name (aka. pass the complete file name)
Dec 18 '09 #13

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

Similar topics

10
by: John Ortt | last post by:
Hi Everyone, I have created a Javascript menu for my site which uses frames. The first stage loads fine but I want two drill down menus ("About Me Menu" and "Projects Menu"). The pages load...
2
by: Kevin Lyons | last post by:
Hello, Can anyone assist me with what I am trying to do with the following code (six different scenarios to try to make the functionality work correctly)? I want to always (and ONLY) display...
3
by: John Ortt | last post by:
I appologise for reposting this but I have been trying to find a solution all week with no avail and I was hoping a repost might help somebody more knowledgable than myself to spot the message... ...
8
by: chrisdude911 | last post by:
how do i add video into a javascript web page with my own custom buttons?
4
by: Greg | last post by:
I'm guessing the problem I'm having has something to do with Master Pages or DetailsView because the exact same code works fine on a page without a Master Page and DetailsView controls. The...
1
by: den2005 | last post by:
Hi everybody, I am confused and still looking why this codes is not working. Can anyone notice or know why this code is not working? Thanks in advance. Code working: <form id="form1"...
8
by: rajesh | last post by:
< script language = javascript c =...
2
by: haft | last post by:
My webpage of discussion contains a javascript powered image gallery of small thumbnail images that when moused-over, display a larger image that corresponds to the current moused-over thumbnail....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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.