473,387 Members | 3,810 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,387 software developers and data experts.

Image Load in IE vs. Mozilla

I'm trying to load a matching image when a link is clicked. The following
test page works OK (the pictures load when their link is clicked) in IE6 but
it does not work in Mozilla 1.5.

----------------------------------------------------------------------------
------------------
<html>
<head>
<title>Test Page</title>
</head>
<SCRIPT LANGUAGE="JavaScript">
function ShowPic1()
{
document.getElementById('imgShow').width = 84;
document.getElementById('imgShow').height = 118;
document.getElementById('imgShow').src = 'images/test_1.gif';
}

function ShowPic2()
{
document.getElementById('imgShow').width = 103;
document.getElementById('imgShow').height = 117;
document.getElementById('imgShow').src='images/test_2.gif';
}
</SCRIPT>
<body>
<a href="javascript:ShowPic1()">Picture #1</a><br>
<a href="javascript:ShowPic2()">Picture #2</a><br>
<br><br>
<img name="imgShow" src="" width="0" height="0"></img>
</body>
</html>
----------------------------------------------------------------------------
------------------

TIA for any assistance...

--
Frank Carr
jf****@msn.com
http://www15.brinkster.com/vbnotebook
Jul 20 '05 #1
9 3691
"Frank Carr" <jf****@msn.com> writes:
I'm trying to load a matching image when a link is clicked. The following
test page works OK (the pictures load when their link is clicked) in IE6 but
it does not work in Mozilla 1.5.
With good reason. document.getElementById('imgShow').width = 84;
You use getElementById (the keyword is "Id"), but
<img name="imgShow" src="" width="0" height="0"></img>


You don't give the img element an id, just a name. Change "name=" to
"id=", and it should work.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2
"Lasse Reichstein Nielsen" <lr*@hotpop.com> wrote in message
news:oe**********@hotpop.com...
You don't give the img element an id, just a name. Change "name=" to
"id=", and it should work.


Thanks...I should have caught that one. Interesting how IE seems to treat
'name' and 'id' the same.
--
Frank Carr
jf****@msn.com
http://www15.brinkster.com/vbnotebook
Jul 20 '05 #3
Frank Carr wrote:
"Lasse Reichstein Nielsen" <lr*@hotpop.com> wrote in message
news:oe**********@hotpop.com...
You don't give the img element an id, just a name. Change "name=" to
"id=", and it should work.


Thanks...I should have caught that one. Interesting how IE seems to
treat 'name' and 'id' the same.


'name' is a legacy property which has been marked for depreciation by the
w3c
Jul 20 '05 #4
"Julian Harse" <ju****@cbtdesign.com> writes:
'name' is a legacy property which has been marked for depreciation by the
w3c


Not in all cases. Only in the cases where it is used to give the
anchor name of the element. Exceptions are form controls (where it
gives the control name), param and meta.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #5
On Sun, 30 Nov 2003 19:15:10 GMT, "Frank Carr" <jf****@msn.com> wrote:
I'm trying to load a matching image when a link is clicked. The following
test page works OK (the pictures load when their link is clicked) in IE6 but
it does not work in Mozilla 1.5.

------------------
<a href="javascript:ShowPic1()">Picture #1</a><br> ------------------

TIA for any assistance...


"<a href="javascript:..." is not a good move, as it means that anyone
without Javascript can't see the picture at all. Better to have
<a href="images/test_1.gif" and use onclick to place it where you want
on the page.

--
Stephen Poley
Jul 20 '05 #6
"Stephen Poley" <sb*****@xs4all.nl> wrote in message
news:4s********************************@4ax.com...
"<a href="javascript:..." is not a good move, as it means that anyone
without Javascript can't see the picture at all. Better to have
<a href="images/test_1.gif" and use onclick to place it where you want
on the page.


The actual pages I'm putting together will probably need to require
Javascript. In the 'non-test' pages a variable number of image files are
selected and uploaded by a separate backend process on a regular basis and a
list of files and their description is put into an array in a separate JS
file. Without having Javascript, the link itself wouldn't be there in the
first place since it's generated in the onload() processing.

If you have any alternative suggestions on how to do this (aside from
running things server side in ASP, JSP, or PHP which I can't do in this
case) I'd like to hear about them.

--
Frank Carr
jf****@msn.com
http://www15.brinkster.com/vbnotebook
Jul 20 '05 #7
On Tue, 02 Dec 2003 13:40:22 GMT, "Frank Carr" <jf****@msn.com> wrote:
"Stephen Poley" <sb*****@xs4all.nl> wrote in message
news:4s********************************@4ax.com.. .
"<a href="javascript:..." is not a good move, as it means that anyone
without Javascript can't see the picture at all. Better to have
<a href="images/test_1.gif" and use onclick to place it where you want
on the page.


The actual pages I'm putting together will probably need to require
Javascript. In the 'non-test' pages a variable number of image files are
selected and uploaded by a separate backend process on a regular basis and a
list of files and their description is put into an array in a separate JS
file. Without having Javascript, the link itself wouldn't be there in the
first place since it's generated in the onload() processing.

If you have any alternative suggestions on how to do this (aside from
running things server side in ASP, JSP, or PHP which I can't do in this
case) I'd like to hear about them.


Well, I'm not 100% sure what your situation is. But if you've got things
being changed dynamically by a back-end process, it does sound as if PHP
/ JSP / ASP would be the way to go. Or Perl. If you are running such
processes, why is it not possible to use one of those four?

--
Stephen Poley
Jul 20 '05 #8
"Stephen Poley" <sb*****@xs4all.nl> wrote in message
news:i0********************************@4ax.com...
Well, I'm not 100% sure what your situation is. But if you've got things
being changed dynamically by a back-end process, it does sound as if PHP
/ JSP / ASP would be the way to go. Or Perl. If you are running such
processes, why is it not possible to use one of those four?


As usual, it goes back to the server that I have to run this on (ie a client
with cheap rented web space). It would be my preference to run it under ASP
or ASP.NET since that's what I have the most experience in but I don't get
that choice this time around.

--
Frank Carr
jf****@msn.com
http://www15.brinkster.com/vbnotebook
Jul 20 '05 #9
Lasse Reichstein Nielsen wrote:
"Julian Harse" <ju****@cbtdesign.com> writes:
'name' is a legacy property which has been marked for depreciation
by the w3c


Not in all cases. Only in the cases where it is used to give the
anchor name of the element. Exceptions are form controls (where it
gives the control name), param and meta.


good point, didn't think about those ; )
Jul 20 '05 #10

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

Similar topics

16
by: Donjuan | last post by:
Hi all I have trouble with tracking whether my image file is loaded. i use DHTML to change my image. HERE is the code: <img name="someimage" src="1.jpg"...
6
by: Weng kin | last post by:
Hi everyone, I have a problem trying to load an image without the image resizing itself to fit into the window. My simple javascript is as follows: function viewImage(filename) { features =...
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...
8
by: TheKeith | last post by:
I'm doing an image cycler but can't figure out why it keeps getting hung up on the third pic in the array? Here is what I have: ...
11
by: Michel | last post by:
Here is a litle script that preload images and show a thumbnail. Once you get on the picture you see the real size It worsk fine with normal picture but when the url has some parameters like in...
1
by: John | last post by:
I am rotating images of different dimensions. My problem is that when a new image is displayed in a new position which had an image of a different dimension, the old image is first stretched to the...
3
by: Becky Carter Hickman-Jones | last post by:
Hi, I have a simple script that opens an image in a new window which is sized to the image. The script is as follows: <a title="xxx"...
14
by: D. Alvarado | last post by:
Hello, I am trying to open a window containing an image and I would like the image to be flush against the window -- i.e. have no padding or border. Can I make this happen with a single call to a...
7
by: Arturo Buonanni | last post by:
Hi to all, I was wondering if User Agents still downolads images you have marked display: none or visibility: hidden wich CSS. Somebody knows how the major web browsers handles these...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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,...

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.