473,473 Members | 2,155 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Firefox/ie issue with img src update?

Hello,

Though this came up in the act of learning js, I'm not actually sure
this is a js question. I can write and call a function to update the
src of an image. But in Firefox the image quickly reverts back to the
original one. In IE it seems to work properly.
I boiled this down to the following lines:

<img name = "myImage" src = "script/images/balloon.gif" width="106"
height="131">
<a href
onClick="document.myImage.src='script/images/heron.gif'"))>heron!</a>

If this isn't a js question, I'd appreciate it someone could point me
in the right direction. Thanks in advance for your understanding and
assistance.

Thanks again,
Dave

Jan 24 '07 #1
2 3107
"David Housman" <dh******@gmail.comwrote in message
news:11**********************@h3g2000cwc.googlegro ups.com...
Hello,

Though this came up in the act of learning js, I'm not actually sure
this is a js question. I can write and call a function to update the
src of an image. But in Firefox the image quickly reverts back to the
original one. In IE it seems to work properly.
I boiled this down to the following lines:

<img name = "myImage" src = "script/images/balloon.gif" width="106"
height="131">
<a href
onClick="document.myImage.src='script/images/heron.gif'"))>heron!</a>

If this isn't a js question, I'd appreciate it someone could point me
in the right direction. Thanks in advance for your understanding and
assistance.

Thanks again,
Dave
Hrmm... no clue if this is the culprit, but why is there 2 parenthesis after the event
handler?

<a href="heron.htm" onclick="document.myImage.src='script/images/heron.gif'; return
false;">heron!</a>

-Lost
Jan 24 '07 #2
-Lost said the following on 1/24/2007 1:14 AM:
"David Housman" <dh******@gmail.comwrote in message
news:11**********************@h3g2000cwc.googlegro ups.com...
>Hello,

Though this came up in the act of learning js, I'm not actually sure
this is a js question. I can write and call a function to update the
src of an image. But in Firefox the image quickly reverts back to the
original one. In IE it seems to work properly.
I boiled this down to the following lines:

<img name = "myImage" src = "script/images/balloon.gif" width="106"
height="131">
<a href
onClick="document.myImage.src='script/images/heron.gif'"))>heron!</a>

If this isn't a js question, I'd appreciate it someone could point me
in the right direction. Thanks in advance for your understanding and
assistance.

Thanks again,
Dave

Hrmm... no clue if this is the culprit, but why is there 2 parenthesis after the event
handler?

<a href="heron.htm" onclick="document.myImage.src='script/images/heron.gif'; return
false;">heron!</a>
The issue was with the lack of a return false in the event handler. The
onclick fires, the image gets changed, the href gets followed and
Firefox is reloading the page so that it goes back to the original image.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jan 24 '07 #3

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

Similar topics

3
by: Olivier Verdin | last post by:
Hi, I have a page with several Textboxes and several DropDownList. When I click on a 'save' button, it creates a record in a database. The page works fine under Internet Explorer. It does...
3
by: TJS | last post by:
I am finding that the serverside requiredvalidator doesn't fire in the firefox browser, and user request proceeds through to my updateProfile method. Validation is working correctly in the IE...
3
by: VK | last post by:
A minor Firefox update was released (now 1.5.0.1) Full list of fixes can be found here: <http://www.mozilla.com/firefox/releases/1.5.0.1.html> Unfortunately the same update bans Venkman for...
7
by: CFonville | last post by:
I have a script that is working fine in the latest version of Firefox with no errors or warnings, but does not work in IE. I have several select boxes that, when changed, update some text (a...
0
by: KPants | last post by:
I'm currently attempting to fix an issue that's been occuring with the design template I made for my Myspace... At first, it looked perfectly fine in Firefox, but in IE, everything was off the the...
8
by: Matt Kruse | last post by:
http://news.zdnet.com/2100-1009_22-6121608.html Hackers claim zero-day flaw in Firefox 09 / 30 / 06 | By Joris Evers SAN DIEGO--The open-source Firefox Web browser is critically flawed in...
2
by: Andy | last post by:
Hi hopefully someone has come accross this issue, as it's doing my head in. We have a flash (.SWF file) banner to display, which does so fine in IE, but in firefox only seems to be about 1/3 size...
3
by: Alexander Higgins | last post by:
Hello, I would like to thank everyone for there help in advance. I have form which is using an iframe as a Rich Text Editor. Everything works as expected in IE but I have two issues with...
7
by: Mel | last post by:
I have an update panel that has the UpdateMode set to "Conditional". When I call UpdatePanel1.Update() in the VB code it does not work in FireFox. It works just fine in Internet Explorer 6.0. Any...
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...
1
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.