Connecting Tech Pros Worldwide Forums | Help | Site Map

Image Load in IE vs. Mozilla

Frank Carr
Guest
 
Posts: n/a
#1: Jul 20 '05
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
jfcarr@msn.com
http://www15.brinkster.com/vbnotebook



Lasse Reichstein Nielsen
Guest
 
Posts: n/a
#2: Jul 20 '05

re: Image Load in IE vs. Mozilla


"Frank Carr" <jfcarr@msn.com> writes:
[color=blue]
> 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.[/color]

With good reason.[color=blue]
> document.getElementById('imgShow').width = 84;[/color]

You use getElementById (the keyword is "Id"), but
[color=blue]
> <img name="imgShow" src="" width="0" height="0"></img>[/color]

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

/L
--
Lasse Reichstein Nielsen - lrn@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Frank Carr
Guest
 
Posts: n/a
#3: Jul 20 '05

re: Image Load in IE vs. Mozilla


"Lasse Reichstein Nielsen" <lrn@hotpop.com> wrote in message
news:oeutir4g.fsf@hotpop.com...
[color=blue]
> You don't give the img element an id, just a name. Change "name=" to
> "id=", and it should work.[/color]

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


--
Frank Carr
jfcarr@msn.com
http://www15.brinkster.com/vbnotebook


Julian Harse
Guest
 
Posts: n/a
#4: Jul 20 '05

re: Image Load in IE vs. Mozilla


Frank Carr wrote:[color=blue]
> "Lasse Reichstein Nielsen" <lrn@hotpop.com> wrote in message
> news:oeutir4g.fsf@hotpop.com...
>[color=green]
>> You don't give the img element an id, just a name. Change "name=" to
>> "id=", and it should work.[/color]
>
> Thanks...I should have caught that one. Interesting how IE seems to
> treat 'name' and 'id' the same.[/color]

'name' is a legacy property which has been marked for depreciation by the
w3c


Lasse Reichstein Nielsen
Guest
 
Posts: n/a
#5: Jul 20 '05

re: Image Load in IE vs. Mozilla


"Julian Harse" <julian@cbtdesign.com> writes:
[color=blue]
> 'name' is a legacy property which has been marked for depreciation by the
> w3c[/color]

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 - lrn@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Stephen Poley
Guest
 
Posts: n/a
#6: Jul 20 '05

re: Image Load in IE vs. Mozilla


On Sun, 30 Nov 2003 19:15:10 GMT, "Frank Carr" <jfcarr@msn.com> wrote:
[color=blue]
>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>[/color]
[color=blue]
>------------------
>
>TIA for any assistance...[/color]

"<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
Frank Carr
Guest
 
Posts: n/a
#7: Jul 20 '05

re: Image Load in IE vs. Mozilla


"Stephen Poley" <sbpoley@xs4all.nl> wrote in message
news:4stosv4r9k27li3hddirclt8rpvifeno97@4ax.com...
[color=blue]
> "<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.[/color]

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
jfcarr@msn.com
http://www15.brinkster.com/vbnotebook


Stephen Poley
Guest
 
Posts: n/a
#8: Jul 20 '05

re: Image Load in IE vs. Mozilla


On Tue, 02 Dec 2003 13:40:22 GMT, "Frank Carr" <jfcarr@msn.com> wrote:
[color=blue]
>"Stephen Poley" <sbpoley@xs4all.nl> wrote in message
>news:4stosv4r9k27li3hddirclt8rpvifeno97@4ax.com.. .
>[color=green]
>> "<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.[/color]
>
>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.[/color]

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
Frank Carr
Guest
 
Posts: n/a
#9: Jul 20 '05

re: Image Load in IE vs. Mozilla


"Stephen Poley" <sbpoley@xs4all.nl> wrote in message
news:i0upsvg36ffg4n2h5f954d22dmoe3nenop@4ax.com...
[color=blue]
> 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?[/color]

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
jfcarr@msn.com
http://www15.brinkster.com/vbnotebook


Julian Harse
Guest
 
Posts: n/a
#10: Jul 20 '05

re: Image Load in IE vs. Mozilla


Lasse Reichstein Nielsen wrote:[color=blue]
> "Julian Harse" <julian@cbtdesign.com> writes:
>[color=green]
>> 'name' is a legacy property which has been marked for depreciation
>> by the w3c[/color]
>
> 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.[/color]

good point, didn't think about those ; )


Closed Thread