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

image rollover

I want to "rollover" an image on a mouseover event, but the image is to be displayed in a different location from the mouse. The image will be in ('ImgBox') and the mouse can be in any cell in a specific column of a table -> giving diff. images.
My code follows, but doesn't work. Any help would be appreciated thanks.

Expand|Select|Wrap|Line Numbers
  1. function ShowImage(artImg) {
  2. //    document.getElementById("ImgBox").src=artImg;
  3. // tried above code and in desperation I tried the following to no avail
  4.     alert (artImg);
  5. }
  6.  
  7. function HideImage(){    
  8. // using a subdirectory off the main site folder
  9. // tried it without the '/images/ - no effect
  10.     document.getElementById('ImgBox').src="/images/Namitjiras_Glen_Helen.jpg" width="390" height="312";
  11. }
The calling routine is
Expand|Select|Wrap|Line Numbers
  1.                 <td> <a href="#" onmouseover="ShowImage(src='images/MonksCowl.jpg')" onmouseout="HideImage()" > Commended  </a> </td>
Happy new year to all.
cheers
Phil
Jan 15 '12 #1
4 1888
C CSR
144 100+
I don't think you put "src=" before the image string as part of the function call. Just put the image path/name in the parameter: ShowImage('images/MonksCowl.jpg')
Jan 15 '12 #2
Tried that too - did not work. I also tried removing the data from the 'ImgBox' and simply hid it - that worked.
Jan 15 '12 #3
C CSR
144 100+
If you had data in the cell where the image was, and all you did is remove/hide the data (text?) then the problem you may have had was sharing the space, and "where was the image actually being positioned." The "position" settings or possibly the z-index for the image would allow for both to appear, overlapping instead of displacing. If that's the case, or if overlapping is what you want there are several tricks to play with the combination of text & image.
Jan 15 '12 #4
Thanks for the reply.
I have 2 distinct elements. A <Div> called 'ImgBox' where I want the image to rollover, and a table.
I want to be able to mouseover any cell of the 2nd column, which will trigger individual <a href="#" .... </a> links to change the image in the 'ImgBox'
ie. row1, col2 --> Img1
row2, col2 --> Img2 etc.

I only used the alert() because I understood it was similar to a msgbox in VB (I have a lot of programming exp. in VB6), and was hoping it would show me I actually had entered the function - it didn't display anything. I included it to show that I had tried all possibilities I could think of.

Many thanks for your help though.
Jan 15 '12 #5

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

Similar topics

4
by: Applebrown | last post by:
Greetings, I'm attempting to make a simple horizontal navbar with three image links, and with those images replaced on hover and active... and I'm not sure of the proper CSS to do this, though...
5
by: jedbob | last post by:
I used Adobe Imageready to build a simple rollover navigation bar, where the text will change color on a mouse over. The working example can be found at:...
4
by: lindsey.crocker | last post by:
I have this links list with background images set on them which changes when they roll over. The <td> is set valign="middle" however as soon as you apply the rollover to the link, the text jumps...
3
by: Mark Szlazak | last post by:
The following page simulates a pool cue and cue ball: http://members.aol.com/myscript/cue.html Mouse cursor position around the cue ball determines where a roll-over of 179 pool cue images is...
2
by: mix2plix | last post by:
ok.. been bangin by brains the past few days with this one and decided to seek you'z help. so here ya go. based on the code below and this concept.. how should i proceed? I have a table of 4...
3
by: modermo | last post by:
Hey new to javascript figuring out how to fix this darn problem. I employ an image rollover, and it works beautifully in safari. But in firefox, the image has an annoying blue border around...
2
by: Casimir | last post by:
I am looking into making pure CSS image rollovers. Do you have any clever (and robust) CSS rollover-tricks? Or links to such "in the wild"? I have figured out two methods for this, but have...
8
by: mrking | last post by:
Hello, I have a test site running at http://artbymichaelking.com/DS/ As you can see with the navigation I have the image rollover. I do this with CSS via: .companyrollover a{ display:...
2
by: mrking | last post by:
Before I go ahead and implement this I need to confirm that what I want can be done. The standard image rollover works well, however this time I want to modify it to show the current selected...
5
mariko
by: mariko | last post by:
I have some pictures on a web page and I want them to "get bigger" when the mouse hovers over them. With the little research I've done, it seems like it would be a rollover effect and something I can...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
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...

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.