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

Toggle Image - Problem in IE

Hi All

I am using the below function to change an image. I have checked in IE
and its working properly if seen locally on my system.

If the same is inserted in a jsp file and accessed from server, image
is toggled but it is not visible.

If we right click on the image and select 'Show Picture' it is
displayed.
Weird IE problem!!!! Anyone has solutions for this.

Kiran Makam
function toggleImg(name){
var obj = document.images[name];
var src = obj.src.toLowerCase();

if(src.indexOf("yes") != -1){
obj.src = "images/no.gif";
obj.alt = "Collapse";
}else{
obj.src = "images/yes.gif";
obj.alt = "Expand";
}
}
Jul 23 '05 #1
4 1482
Thats weird,

I don't know why it goes wrong, but maybe preloading the images might
help. In the header, put the following code:

<SCRIPT LANGUAGE="JavaScript">
imYes = new Image();
imYes.src = 'images/yes.gif';
imNo = new Image();
imNo.src = 'images/no.gif';
</SCRIPT>

You're sure those images are the correct filenames? Did you check for
upper & lowcase? might be sensetive to that.

Jul 23 '05 #2
Thanks Beveren.

I have preloaded the images, still the problem persists. I checked
browser cache after the page is loaded, preloading is working fine.

If i try the function in a static page on my system, it works; when it
is added to a jsp file and accessed from server images refuses to show
up!!!!!

Kiran
Jul 23 '05 #3
> If i try the function in a static page on my system, it works; when it
is added to a jsp file and accessed from server images refuses to show
up!!!!!


I have no idea. Sorry. It should indeed work.

Jul 23 '05 #4
kiran wrote:
Thanks Beveren.

I have preloaded the images, still the problem persists. I checked
browser cache after the page is loaded, preloading is working fine.

If i try the function in a static page on my system, it works; when it
is added to a jsp file and accessed from server images refuses to show
up!!!!!

Kiran


Check the source the browser is seeing. It's most likely that when the JSP
outputs the client-side JavaScript, you are losing quotation marks
somewhere along the way.

--
| Grant Wagner <gw*****@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 23 '05 #5

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

Similar topics

3
by: Jürgen Heyn | last post by:
Good morning, on form 2 input elements and 1 image are placed. The 1st (Index) one is "hidden", the 2nd ) is an empty textbox. When clicking the picture I would like to toogle a boolean value....
2
by: leegold2 | last post by:
I wondered if anyone would give me code- I think it would be easy, but I'm a complete newbie. What I want to do is to show many tables in a brief truncated format and then for each table offer the...
2
by: Brian | last post by:
Im trying to toggle a series of images with an onLoad event. I have my code checking the value of a hidden textbox. Depending on the value pf the text box, it will display one image for one and...
2
by: Madame Blablavatsky | last post by:
hello, i have an image that is also a link: <a href="javascript:opmaak('bold','')"><img src='bold_uit.gif name='uit'></a> when the image/link is clicked it triggers a javascript that...
0
by: Arnold | last post by:
Hi there, I have a form to organize bottles in mind, but am unsure if it will work. Here's some background info: Mainform = frmProduct, which contains fields for pricing, status, etc. of...
5
by: Steven | last post by:
Can anyone tell me how to toggle the "Caps Lock" key? Thanks in advance
1
by: swiftouch | last post by:
I'm getting an error message in FF2.0: document.getElementById(toggle) has no properties The goal of the script is, when I hover my mouse over an image, to make one div element visible while...
4
by: ameshkin | last post by:
I have a checkbox with an ID of svc_tp_1, and an image that corresponds with this checkbox below it. <input type="checkbox" name="checkbox" id="svc_tp_1" value="svc_tp_1" / <img...
1
by: Amit1980 | last post by:
I have to toggle the arrow image on onclick event. Here is the code with the required functionility. What I want now is, when the page loads there will be right arrow images. The arrow should be...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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?
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...

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.