473,748 Members | 2,506 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

<input type="image" ... does not show up as a form element! why?

Hi all,

I was trying to make an image submit button with a rollover and discovered
to my suprise that there is no way to access a form element of the "image"
type. I tried specifying it by name and also by the elements[] array with
no luck.
Even weirder, I can sandwich an image button in between other input types
and then write a script diplaying the contents of the elements array and it
acts as if the image button does not exist at all!
For example the following:
<input type="text" ... > : this is elements[0]
<input type="checkbox" ...> : this is elements[1]
<input type="image" ...> : this does not exist!
<input type="text" ...> : this is elements[2]

Does anyone know of any way to access (or set) the properties of an image
input type?
I ask, because I wanted to have a rollover action on a button that also can
POST a form WITHOUT using submit() - in order that non-Javascript enabled
browsers can fail gracefully (i.e. the form is still POSTed).
TIA!
MC Dave
Jul 23 '05 #1
1 3050
Solution:
Because the "image button" is not accessible via the elements collection nor
by directly naming it (i.e. forms[0].elements[5] OR myform.BTNconti nue)
BUT you can utilize "this" to change a property directly as in the example
below where a rollover can be specified directly:

<INPUT TYPE="image" name="BTNcontin ue"
src="images/buttons/btncontinueshop ping.gif"
onmouseover="th is.src='images/buttons/btncontinueshop ping_f2.gif'"
onmouseout="thi s.src='images/buttons/btncontinueshop ping.gif'">

To reference it from an outside script:
<INPUT TYPE="image" name="BTNcontin ue"
src="images/buttons/btncontinueshop ping.gif" onmouseover="ro llon(this);"
onmouseout="rol loff(this);">

<script language="JavaS cript">

function rollon(myref)
{
myref.src='imag es/buttons/btncontinueshop ping_f2.gif';
}

function rolloff(myref)
{
myref.src='imag es/buttons/btncontinueshop ping.gif';
}

</script>

"Dave" <dave(delete_th is)@miraclecatD ELETETHISTOO.co m> wrote in message
news:V_Xdc.4287 $xn4.17460@attb i_s51...
Hi all,

I was trying to make an image submit button with a rollover and discovered
to my suprise that there is no way to access a form element of the "image"
type. I tried specifying it by name and also by the elements[] array with
no luck.
Even weirder, I can sandwich an image button in between other input types
and then write a script diplaying the contents of the elements array and it acts as if the image button does not exist at all!
For example the following:
<input type="text" ... > : this is elements[0]
<input type="checkbox" ...> : this is elements[1]
<input type="image" ...> : this does not exist!
<input type="text" ...> : this is elements[2]

Does anyone know of any way to access (or set) the properties of an image
input type?
I ask, because I wanted to have a rollover action on a button that also can POST a form WITHOUT using submit() - in order that non-Javascript enabled
browsers can fail gracefully (i.e. the form is still POSTed).
TIA!
MC Dave

Jul 23 '05 #2

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

Similar topics

3
4275
by: news | last post by:
I'm working with a CGI program that was using several standard buttons for input using <input type="submit" name="abuttonName" ... Now, I'm trying to replace the standard buttons with images using an onClick function. For 1 button it's easy enough - document.forms.submit(); but how do I let the CGI script know which one of the buttons were clicked?
5
10457
by: Mikko Rantalainen | last post by:
See example at <URL:http://www.cc.jyu.fi/~mira/moz/formtest.php>. The problem is that the label of submit button is always centered on the button regardsless of 'text-align' property in CSS. Considering that I can style everything else, this must be a bug, right? Any suggestions how to fix the issue with Mozilla 1.4? How about other versions of Mozilla? How about other browsers? (I'm aware that some people think that one should never...
1
3295
by: Mark Sandfox | last post by:
Is there a way to restrict the user to only selecting and sending either a ..gif or .jpg. Everything I have read says this option can not be done by design (security reasons). I find that irronic as this is the reason (security) that I want to restrict their selection. Any help on this one will be greatly appreciated. The page is using ASP.NET.
17
3208
by: Alan Silver | last post by:
Hello, I have a page which I am converting to use themes. The page has an HTML <input type="image"> element that is used to post to another page. I would like to replace this with a server control so I can add a skinid. I tried adding runat="server" and the skinid to the existing control, but that didn't work. Any other ideas? TIA --
2
2763
by: Alan Silver | last post by:
Hello, If I have the following HTML... <input type="image" src="fred.gif"> .... is there a way to specify the image in CSS rather than in the HTML? TIA
3
4719
by: Bill | last post by:
Hi In a css page I have the following: ..OLC{float:left; width:150px;text-align:center; } OL{ list-style-position:inside;} LI{ height:160px;}
3
2036
by: PJ6 | last post by:
Embedded javascript can be served from a DLL with an include that uses a special URL generated by the Page.ClientScript.GetWebResourceUrl method at runtime. For example: <script src="/DEV-WEB/WebResource.axd?d=Fzr7sc4IZAELIE4FCpgaNkpd1YgQqgig1EfiFj9_b7U1&t=633202779231250800"type="text/javascript"></script> .... so can style sheets: <link rel="stylesheet" type="text/css"
3
2257
by: =?Utf-8?B?V2lsbA==?= | last post by:
I have an image "button" which causes a postback. I handle the "click" with If Request.Form("btnBU7WD6_Submit.X") 0 Then... this works great. However, when a user double-clicks the image button the Page_Load (postback) is processed twice. This is a problem. Is there any easy way to detect that the image button has been double-cliked
0
9555
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9250
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8247
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6796
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6076
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4607
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4878
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3315
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 we have to send another system
2
2787
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.