473,511 Members | 15,302 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Change image button type problem in IE

Hello All
On a webpage I have a standard paypal image button for purchases. I am
trying to set it up so that it only shows up or is endabled when text
is entered into a textbox and a button is pressed. To do this I set the
type to hidden and changed the type of the button using javascipt to
image. This works perfectly in Modilla's Firefox but in IE it says
there is a scipt error.

Here is the javascipt

<script type="text/javascript">
function UpdateFields() {
if (UsernameForm.txtUserName.value == "") {
var msg = "Please enter a User Name";
alert(msg);
return;
}
document.form8130.btnSubmit.type = "image";
document.form8130.on0.value = UsernameForm.txtUserName.value;
} //disabled="true"
</script>

The paypal button is setup as follows
<form name ="form8130" target="paypal"
action="https://www.paypal.com/cgi-bin/webscr" method="post">
<div align="center"><b><font color="#FFFFFF" size="-1"
face="Arial,Helvetica,Geneva,Sans-serif,sans-serif">
<input name="btnSubmit" type="hidden"
src="../../../images/Paypal/sc-but-03.gif" alt="Pay for your locomotive
with PayPal - it's fast, free and secure!" width="106" height="24"
border="0">
</font></b></div>
</form>
If I remove the following line from the script then I do not get the
error in IE

document.form8130.btnSubmit.type = "image";

Can anyone see what I have done wrong here? Is there another way to
enable or disable an image button?

Thanks in Advance

Phil

Aug 7 '06 #1
1 6114

Ph******@bigpond.net.au wrote:
Hello All
On a webpage I have a standard paypal image button for purchases. I am
trying to set it up so that it only shows up or is endabled when text
is entered into a textbox and a button is pressed. To do this I set the
type to hidden and changed the type of the button using javascipt to
image. This works perfectly in Modilla's Firefox but in IE it says
there is a scipt error.
I think the idea of hiding the button completely creates a usability
issue - people may well wonder what the form is for if there is no
submit button.[1]

But anyhow, you could leave the input as type image and then set its
visibility to hidden or visible as required.

You could also set the button as 'disabled' and provide a disabled
image in the HTML, then swap to the 'enabled' image and enable the
button when you've validated the text input's content.

The usual caveat applies - anyone with javascript disabled/not
available will not be able to enable the button or to submit the form
unless you use script to disable it in the first place. That infers
that your server must be able to deal with invalid input, hence the
value of hiding/showing or disabling/enabling the button is moot.
1. People expect a standard submit button, many find image buttons
confusing. I've seen even experience users stare at standard Windows
install dialogs because the 'inatall' button looks nothing like a
standard dialog button. Most of the submit button images I've seen try
to look very much like a standard submit button for this reason, which
leads one back to question why an image is being used instead of a
standard submit button. It will also make users nervous about clicking
on images if some are used to submit forms.
--
Rob

Aug 7 '06 #2

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

Similar topics

8
17284
by: Matt Herson | last post by:
I have been trying to find a way to use JavaScript to change the value of a hidden field on submit. I am already invoking a JavaScript to handle the validation on submit. The reason I need to...
14
2467
by: Reply Via Newsgroup | last post by:
Folks, Say I have a table, ten columns, ten rows - Each with a word in it. I want to change the values of some/all of the cells in the table via a hyperlink. How do I reference each cell and...
6
6876
by: Marek Mänd | last post by:
Can the <button><img></button> mutated via CSS so, that the inner image of <BUTTON> would entirely visually become the button itsself - I mean without the outer elements borders and so... ...
2
9518
by: Ben | last post by:
Hi. I have a button that change a number of images src's when I click a button. The src's are stored in an array and I just use document.src=pics to change the src of the image. However I want...
6
22115
by: ruca | last post by:
Hi gurus, I have a imagebutton in my WebForm, and I want that when I click (mouse down) on her the imagebutton change image and when I "unclick" (mouse up) change to the original image. Basically...
2
5101
by: RC | last post by:
I have CSS for button like input { background-image: url(imageFile.gif); background-repeat: no-repeat; background-position: right center; border-width: 0; border-spacing: 0; padding: 0;...
16
2836
by: browntown | last post by:
so I have this application I'm nearly finished with. The only thing the client has requested is the ability to submit the form by pressing "enter". I didn't think this would be a huge pain in the...
2
2351
by: Poppa Pimp | last post by:
ImageResizer.php Image Resizer PLEASE HELP The URL of the page this is on in my site is http://poppa-pimps-wallpapers.com//ImageResizer.php You can click on browse and get image,but...
3
2574
by: printline | last post by:
Hi' I have a little problem with the onclick event. I have an image that i use as a button. When i click this image/button some text appears and a new image/button also appears. when i then click...
0
7153
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7432
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7093
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5676
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,...
1
5077
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...
0
4743
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...
0
3218
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1583
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 ...
0
452
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.