473,396 Members | 1,847 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.

Help: swap Image Link works in IE but Not FF

I'm not much of a JS programmer so I used the the standard Macromedia swap
image function for a disjointed rollover..which works
fine.. no problem swapping the image with that code....

but when I add the following to the onMouseOver to the thumbnail:
onMouseOver="Product_Link.href='http://glasstoilets.com/catalog/tank1-p-28.html';

and

this to the full size...

<a href="" name="Product_Link"><img src="Files/images/300x216/PICT0876.jpg"
name="Main_Image" width="300" height="216" id="PICT1204_l"</a>

It works fine in IE but not firefox... Meaning the images swap no problem in
both but the link only works in IE. My searching tells me that I may have
to use getElementById() but I'm not sure how to implement it in this
scenario.

Any help is greatly appreciated.
pejo
------------------------------------------------------
"Before you criticize someone
Walk a mile in their shoes
Then when you do criticize them
you'll be a mile away and
Wearing their shoes"
---seen on a wall somewhere in London
May 25 '07 #1
3 1989
PEJO wrote on 25 mei 2007 in comp.lang.javascript:
I'm not much of a JS programmer so I used the the standard Macromedia
swap image function for a disjointed rollover..which works
fine.. no problem swapping the image with that code....

but when I add the following to the onMouseOver to the thumbnail:
onMouseOver="Product_Link.href='http://glasstoilets.com/catalog/tank1-p
-28.html';

and

this to the full size...

<a href="" name="Product_Link"><img
src="Files/images/300x216/PICT0876.jpg" name="Main_Image" width="300"
height="216" id="PICT1204_l"</a>

It works fine in IE but not firefox... Meaning the images swap no
problem in both but the link only works in IE. My searching tells me
that I may have to use getElementById() but I'm not sure how to
implement it in this scenario.

Any help is greatly appreciated.
Try this first:

<img src="Files/images/300x216/PICT0876.jpg"
onMouseOver="this.href='http://glasstoilets.com/catalog/tank1-p-28.html'"
onmouseout="this.href='Files/images/300x216/PICT0876.jpg'"
>
======================

FF correctly does not use a element name as an object.

Try:

<img src='' id="Plnk">

<img src="Files/images/300x216/PICT0876.jpg"
onMouseOver=
"document.getElementById('Plnk').href =
'http://glasstoilets.com/catalog/tank1-p-28.html'"
>


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
May 25 '07 #2
OK I've tried this.. I'm getting a JS error when I rollover the small image.
It swaps the image but not the links.

here is the code I implemented as per your explanation.

for the thumbnail:

<a href="http://glasstoilets.com/catalog/tank1-p-28.html"
onMouseOver="MM_swapImage('Bass_model_s','','Files/images/70x50/Bass_model.jpg',1);MM_swapImage('Main_Image','','F iles/images/300x216/Bass_model.jpg',1)"><img
src="Files/images/70x50/Bass_model.jpg"
onMouseOver="document.getElementById('Plnk').href= 'http://glasstoilets.com/catalog/tank1-p-28.html';"
name="Bass_model_s" border="0" id="Bass_model_s"></a>

(The Debug popup points to an error in the above code.)
here is what I have for the main image as well

<img src="Files/images/300x216/PICT0876.jpg" name="Main_Image" width="300"
height="216" id="Plnk">

pete.


"Evertjan." <ex**************@interxnl.netwrote in message
news:Xn********************@194.109.133.242...
PEJO wrote on 25 mei 2007 in comp.lang.javascript:
>I'm not much of a JS programmer so I used the the standard Macromedia
swap image function for a disjointed rollover..which works
fine.. no problem swapping the image with that code....

but when I add the following to the onMouseOver to the thumbnail:
onMouseOver="Product_Link.href='http://glasstoilets.com/catalog/tank1-p
-28.html';

and

this to the full size...

<a href="" name="Product_Link"><img
src="Files/images/300x216/PICT0876.jpg" name="Main_Image" width="300"
height="216" id="PICT1204_l"</a>

It works fine in IE but not firefox... Meaning the images swap no
problem in both but the link only works in IE. My searching tells me
that I may have to use getElementById() but I'm not sure how to
implement it in this scenario.

Any help is greatly appreciated.

Try this first:

<img src="Files/images/300x216/PICT0876.jpg"
onMouseOver="this.href='http://glasstoilets.com/catalog/tank1-p-28.html'"
onmouseout="this.href='Files/images/300x216/PICT0876.jpg'"
>>

======================

FF correctly does not use a element name as an object.

Try:

<img src='' id="Plnk">

<img src="Files/images/300x216/PICT0876.jpg"
onMouseOver=
"document.getElementById('Plnk').href =
'http://glasstoilets.com/catalog/tank1-p-28.html'"
>>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

May 28 '07 #3
PEJO wrote on 28 mei 2007 in comp.lang.javascript:
OK I've tried this.. I'm getting a JS error when I rollover the small
image. It swaps the image but not the links.
PLEASE do not toppost, but post under each part of the text you aree
reacting on.

here is the code I implemented as per your explanation.

for the thumbnail:

<a href="http://glasstoilets.com/catalog/tank1-p-28.html"
onMouseOver="MM_swapImage('Bass_model_s','','Files/images/70x50/Bass_mo
MM_swapImage() what function is that?
del.jpg',1);MM_swapImage('Main_Image','','Files/images/300x216/Bass_mod
el.jpg',1)"><img src="Files/images/70x50/Bass_model.jpg"
onMouseOver="document.getElementById('Plnk').href= 'http://glasstoilets.
com/catalog/tank1-p-28.html';" name="Bass_model_s" border="0"
id="Bass_model_s"></a>
So you have TWO onmouseovers over each other,
each changing some attribute of the other?

Why?

I do not even know what you want to accomplish.

Do you?

Why would you want to change an <ahref on mouseover, since you cannt
click it without first hoovering?
(The Debug popup points to an error in the above code.)
What is a "Debug popup"?
What error?
What line of code?

btw, why do you name an img that has a id?
here is what I have for the main image as well

<img src="Files/images/300x216/PICT0876.jpg" name="Main_Image"
width="300" height="216" id="Plnk">
==============================

The best I can do for you is deleting all the code junk that is not
part of the probem and show you this:

<img
src='PICT0876.jpg'
id='Plnk'
>
<br><br>
<img
src='img1.jpg'
onMouseOver='doit(this);'
onClick= 'goThere();'
alt = 'Hover me or click me!'
>
<script type='text/javascript'>

function doit(x) {
x.src = 'img2.jpg';
x.style.cursor = 'pointer';
document.getElementById('Plnk').src =
'PICT0999999.jpg';
};

function goThere() {
location.href = 'http://cnn.com/';
};

</script>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
May 28 '07 #4

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

Similar topics

3
by: Randell D. | last post by:
Folks, I'm still learning javascript - I've invested in a couple of books and reading online as much as possible. I'm pretty sure what I am suggesting is possible though I'm trying to weigh up...
3
by: Steve | last post by:
Hi, I have a nice little script that works well displaying images on my website. It's a script where if you clik a thumbnail image a pop up window opens that contains a larger version of the same...
1
by: portraitmaker | last post by:
I found some drag and drop code on the web and modified it a little b taking out some of the stuff I didn't need. This sample allows you to drag an image in a table to another positio and swaps...
8
by: OysterCracker | last post by:
Hi - I've previously used js to swap images on mouseover in a menu. I'm stumped on a different situation and would appreciate some advice. I would like to swap imageA to ImageB when I mouseover...
6
by: Karl | last post by:
Hi, Ok so on a given page I have 4 text links: see it in black see it in blue see it in red see it in green using the standard swap image behavior, clicking on one of the above links
7
by: KiwiBrian | last post by:
On a web page I have a graphic for a Shopping Cart Submit button. It is within a form and working fine. I would like to perform an image swap to an identical graphic of a different colour when I...
3
by: steve.peticca | last post by:
Hi, My onmousevent fails to switch the large photo with one of the smaller images. To be frank, I'm extremely new to Javascript programming and as such, am trying to learn from other sites...
3
by: Stephen Torri | last post by:
Below is a class that is suppose to represent a segment of memory or a contents of a binary image (e.g. ELF executable). I have started to read Modern C++ Design and thought the best way to ensure...
1
by: irfankissa | last post by:
Hi to every one, I would like to ask if any one knows how to resize the picture with javascript. I have used the swap img within my page, and I would like the second img to be different size than...
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
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
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
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
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.