469,648 Members | 1,410 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,648 developers. It's quick & easy.

INPUT type=image

This is a bit off-topic, but...

Is it possible to write client side script that can address INPUT controls
with a type of "image" which will work under Netscape/Mozilla?

<INPUT type="image" ...>

Controls of this type are excluded from the forms[].elements collection and
'document.all[]' isn't supported my Mozilla browsers?

Any way to do this?

-- dwa
Nov 18 '05 #1
1 1423
Hi Dwa,

Thanks for posting in the community!
From your description, you'd like to address and do some operations on a
<input type=image..> control in a web page via client side javascript.
Also, you found that the "document.all" member isn't supported by Mozilla
explorer, yes?
If there is anything I misunderstood, please feel free to let me know.

Based on my research, this problem does due to the different browsers have
different supports on the javascript apis, the "document.all" is not
supported in Mozilla, in Mozilla, we need to use the
"document.getElementById()" to get an page element by its id, and I've
tested using the below code in Mozilla 1.6, it worked well.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
<script language="javascript" >
function SetImgSrc(oid)
document.getElementById(oid).src =
<form id="Form1" method="post" runat="server">
<table width="500" align="center">
<IMG id="imgImg" alt="MSDN"
<input id="imgInput" type="image"
<INPUT id="btnImg" type="button" value="Change Img's src"
onclick="SetImgSrc('imgImg')" >
<INPUT id="btnInput" type="button" value="Change input's src"
onclick="SetImgSrc('imgInput')" >
Please also try it out on your side to see whether it works. In addition,
here is a tech aritcle which has discussed on
how to set src attribute via clientside javascript under different browsers

#Extending setSrc() to Mozilla Browsers

I believe it also helpful to you.


Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Mark | last post: by
1 post views Thread by Brian Genisio | last post: by
7 posts views Thread by b2b2u | last post: by
1 post views Thread by champ.supernova | last post: by
3 posts views Thread by jackiepatti | last post: by
8 posts views Thread by John | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.