473,796 Members | 2,708 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Firing event handler with rolling image script obtained from a tutorialwebsite .

Hi

On my webpages I have replaced the submit button with a rolling submit
button using the script below (Script 1). This script is used by many
of my webpages and is included in a external file.

There are two webpages that use onSubmit event handler to fire a script
in an external file but the event handler is no longer firing.
onSubmit ="return validating_user name_and_passwo rd()"

How would I change the script below so that it will fire onSubmit event
handler or any other event handler?

Script 1
<!--
// copyright 1999-2001 Idocs, Inc. http://www.idocs.com/tags/
// Distribute this script freely, but keep this
// notice with the code.
var submitRolls = new Object();

function submitroll(src, oversrc, name)
{
this.src=src;
this.oversrc=ov ersrc;
this.name=name;
this.alt="Submi t Query";
this.write=subm itroll_write;
}

function submitroll_writ e()
{
var thisform = 'document.forms[' + (document.forms .length - 1) + ']';
submitRolls[this.name] = new Object();
submitRolls[this.name].over = new Image();
submitRolls[this.name].over.src = this.oversrc;
submitRolls[this.name].out = new Image();
submitRolls[this.name].out.src = this.src;

document.write
(
'<A onMouseOver="if (document.image s)document.imag es[\'' + this.name +
"'].src=submitRoll s['" + this.name + '\'].over.src"' +
' onMouseOut="if (document.image s)document.imag es[\'' + this.name +
"'].src=submitRoll s['" + this.name + '\'].out.src"' +
' HREF="javascrip t:'
);

if (this.sendfield )
{
if (! this.sendvalue)
this.sendvalue = 1;
document.write( thisform, ".elements['", this.sendfield, "'].value='",
this.sendvalue, "';");
}

document.write( thisform + '.submit();void (0);"');
if (this.msg)docum ent.write(' onClick="return confirm(\'' , this.msg,
'\')"');
document.write( '>');

document.write( '<IMG SRC="' + this.src + '" ALT="' + this.alt + '"
BORDER=0 NAME="' + this.name + '"');
if (this.height)do cument.write(' HEIGHT=' + this.height);
if (this.width)doc ument.write(' WIDTH=' + this.width);
if (this.otheratts )document.write (' ' + this.otheratts) ;
document.write( '></A>');
if (this.sendfield )
{
document.write( '<INPUT TYPE=HIDDEN NAME="' + this.sendfield + '">');
document.forms[document.forms. length -
1].elements[this.sendfield].value='';
}
}

//-->

Your help will again be appreciated. (This is my secong request for
assistance today).

Regards

Bundy
Oct 1 '06 #1
2 1990
Bundy wrote:
Hi

On my webpages I have replaced the submit button with a rolling submit
button using the script below (Script 1). This script is used by many
of my webpages and is included in a external file.

There are two webpages that use onSubmit event handler to fire a script
in an external file but the event handler is no longer firing.
onSubmit ="return validating_user name_and_passwo rd()"
What you are doing is calling the submit() method of the form rather
than using a submit button. The effect is that the form's submit
method is not called when the pseudo submit button is clicked. It also
means that users with JavaScript disabled or not available, or those
where your script doesn't run properly, can't submit your forms.

If you wish to use a roll-over for the submit button, then use an input
type image (which is a submit button by default) and ditch all that
code. There are some side effects to that in IE if you are using
multiple submit buttons for the one form.

If you want to keep using an A element and onclick to call the form's
submit method (not a good idea), then at least use CSS and the A
element's hover attribute to swap the image, using the code you have is
very inefficient. You should be able to adapt the following:

<URL: http://www.alistapart.com/articles/slidingdoors2/ >

It also means your buttons only need one image that slides up/down or
left/right, not two. The result is no pre-loading, no extra img
objects, no additional script, etc. You can use the same strategy for
an image button, but since IE doesn't support the hover attribute on
anything other than A elements, use onmouseover/out to slide the image.
Then users without javascript can still submit your forms.

How would I change the script below so that it will fire onSubmit event
handler or any other event handler?
I would ditch it altogether and use a real submit button.

Script 1
<!--
HTML comments delimiters inside script elements are completely
unnecessary, just don't use them.

[...]
--
Rob

Oct 1 '06 #2
Thank you

I have got rid of all the code and instead using two images with
onmouseover and onmouseout.

Will look into using one image with CSS.

Regards

Bundy
Oct 2 '06 #3

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

Similar topics

10
3607
by: tony kulik | last post by:
This code works fine in ie and opera but not at all in Mozilla. Anybody got a clue as to how to get it right? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <script language="JavaScript" type="text/javascript"> function show(that) { if (box.style.visibility=='hidden') { that.style.visibility = 'visible'}; }
3
4690
by: Vikram Bhatia | last post by:
1. Is there an event to capture scrolling using mouse wheel in Netscape 6.x? 2. When arrow keys are used to scroll a page in Netscape 6.x, the scrolling offsets obtained using 'window.pageXOffset' and 'window.pageYOffset' are not correct. Is there any other way to get the correct scrolling offsets?
1
10212
by: Adam Ratcliffe | last post by:
I'm trying to come up with a solution for detecting when an image, loaded by a script, has completely loaded. The Image.onload event is fired after the image has loaded in Firefox but before loading has completed in Internet Explorer. The function where I assign the onload event handler looks like this: var newImage = new Image(); function getImage(url) { var image = document.getElementById("theImg");
3
3159
by: jeff29_b | last post by:
I am having a strange problem on a web form. I have an image button with an OnClick event handler. When I click the image the event isn't being called in the code behind when browsing in firefox. I get the postback but I never have the event called. It works fine in i.e.
10
3880
by: Wylbur via DotNetMonster.com | last post by:
Hello to all of you geniuses, I'm having a problem trying to get an Init handler to fire for a Placeholder control at the initialization phase. I’ve posted this problem to 3 other ASP.NET forums, and noone wants to touch it. I tried to attach a literal control to a placeholder: <>-<>-<>-<>-<>-<>-<>-<>-<>-<>-<>-<>
28
10280
by: Tim_Mac | last post by:
hi, i'm new to .net 2.0, and am just starting to get to grips with the gridview. my page has autoEventWireUp set to true, which i gather is supposed to figure out which handlers to invoke when appropriate based on your method names . the GridView has OnRowCommand="GridView1_RowCommand" in the aspx. my problem is that the RowCommand event is firing twice (95% of the time) on the page. the other 5% it only fires once. there's no
0
2958
by: Demetri | last post by:
I have created a web control that can be rendered as either a linkbutton or a button. It is a ConfirmButton control that allows a developer to force a user to confirm if they intended to click it such as when they do a delete. Everything is great. By and large it will be used in my repeater controls using the command event when the user clicks on it and so that event is working great. My issue is the Click event. When the control is...
2
2854
by: APA | last post by:
Why does adding code to the form submit function using the RegisterOnSubmitStatement method prevent the server side event handler for the submit button from firing? This is completely useless. I need some custom javascript validation on form submit but why does is kill the submit button event handler? Submit buttons don't use __doPostBack so what is being effected?
8
4117
banning
by: banning | last post by:
<!-- Google maps has a tendency to wreck things. Load it LAST! It can interfere with other stuff loading --> <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAArSHIvK5GjeMNDX4RccZ9MhQrmFaz44GnQXOo27J3f2GHeKYI9xTi9qFD_LdIDqtpRDvM4YWE8kto-A" type="text/javascript"></script> <script type='text/javascript'> function setImage() { document.getElementById('eventLogoDiv').innerHTML='<a...
0
9685
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10239
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10190
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10019
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...
1
7555
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
6796
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
5447
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...
2
3736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2928
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.