473,586 Members | 2,652 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

javascript rollover with a submit button



Here's the script section:
function change(color){
var el=event.srcEle ment
if (el.tagName=="I NPUT"&&el.type= ="button")
event.srcElemen t.style.backgro undColor=color
}

function jumpto2(url){
window.location =url
}

if the form uses a type=button when kyou rollover the button it changes

form onMouseover="ch ange('87cefa')" onMouseout="cha nge('d3d3d3')"
input type="button" value="Hosting " class="color2"
onClick="jumpto 2('hosting.html ')"

however if the input type is submit instead of button when the button is
rolled over it does not change color here is what I mean:

form action="process Login.jsp" method="post" onMouseover="ch ange('87cefa')"
onMouseout="cha nge('d3d3d3')"
input type="text" name="userName"
INPUT TYPE="submit" value="Login" class="color2"

My question is if the method is post and the input type is submit anyway to
make it rollover? if not what would a javascript look like that would use
the post method?

Thanks
Pete
Jul 23 '05 #1
1 2226
"Oxnard" <sh******@no-spam.comcast.ne t> writes:
Here's the script section:
The script is IE-only. Not very good for internet use.

A more compatible version would be:
---
function change(event, color) {
var elem = event.target || event.srcElemen t;
if (elem.tagName == "INPUT" && elem.type == "button") {
elem.style.back groundColor = color;
}
}
---
if the form uses a type=button when kyou rollover the button it changes

form onMouseover="ch ange('87cefa')" onMouseout="cha nge('d3d3d3')"
input type="button" value="Hosting " class="color2"
onClick="jumpto 2('hosting.html ')"
There is some markup missing here (no "<"'s and ">"'s).
however if the input type is submit instead of button when the button is
rolled over it does not change color
Ofcourse. The script tests for (elem.type=="bu tton"), so it won't
match an input element with type="submit".
here is what I mean: .... My question is if the method is post and the input type is submit anyway to
make it rollover?


The form's method is not relevant. It is the type of the button that
fails to be "button". If you want the script to also work on submit
and reset buttons, you can use:
---
function change(event, color) {
var elem = event.target || event.srcElemen t;
if (elem.tagName == "INPUT" &&
( elem.type == "button" ||
elem.type == "submit" ||
elem.type == "reset")) {
elem.style.back groundColor = color;
}
}
---

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #2

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

Similar topics

1
10267
by: Frances Del Rio | last post by:
I have a form in which submit button is an img.. would like to do it w/a rollover, but can't get rollover to work.. can you do rollovers w/img submit buttons? this is code I have: <input type="image" name="log" src="images/login.gif" value="Submit" alt="Submit" onMouseover = "log.src='images/login-roll.gif'" onMouseout...
21
24425
by: Martin Eyles | last post by:
I am trying to get javascript to cause a page to post back. I have tried calling _doPostBack from my script, but generates an error "object expected". I think this is because the page's script doesn't contain the method _doPostBack, which needs to be added by asp.net. How can I make asp.net add this script? Thanks, ME --
6
3179
by: AJBopp | last post by:
I'm wrestling with CSS variations between Firefox and IE. I'm trying to create rollover buttons in a menu frame. It is working perfectly in Firefox but in IE only the first button is properly highlighted and linked. The second button, has only a partial "hit area" at the top of the image, although if you click the link, you can see the link...
1
1039
by: Savas Ates | last post by:
How can i add javascript code to my server control object ? I want to add a javascript code when a user OnClick it .. Is there any sample code or reference web site or knowledge to solve it ? <asp:Button id="Button1" style="Z-INDEX: 101; LEFT: 6px; POSITION: absolute; TOP: 6px" runat="server" Text="Button"></asp:Button>
10
6068
by: ljlolel | last post by:
So.. I have a form that submits to an ASP.net site made in C-sharp. The ASP site is not mine, i do not have the server side code. When I submit from my form by pressing the Submit button, I get different results than when I use a javascript submit: form1.submit();. I think the javascript submit is working as it should, since I want the...
10
6065
by: IchBin | last post by:
I am trying to set the state of a radio button. I do not see what I am doing wrong. Sorry, I am new at this.. I need another set of eyes to look at this snip of code. I am trying to set the radio button with this link of code: echo 'SCRIPT language=JavaScript setCheckedValue("'.$_SESSION.'");</SCRIPT>'; //? <snip of code>
5
2823
by: Rabel | last post by:
I am a flash designer so I dont know a whole lot about the javascript submit buttons (I may not even be describing it right sorry) but here is the code I am using. <IMG name="Checkout" value="Checkout" SRC="imagesButtons/ purchaseButton_r2_c2.jpg" onMouseOver="this.src = 'imagesButtons/ purchaseButton_r2_c2_f2.jpg'" onMouseOut="this.src =...
1
1273
by: willCrain | last post by:
I am pretty much stuck and dont know which direction to procede in figuring this out. My desired end result is to have top_home button and bottom_home button to be on opposite areas of the page, but when I rollover top_home or bottom_home the other reacts with thier own roll over state as though they are just one button. (rollover 1 and both...
3
2726
by: Oriane | last post by:
Hi there, I would like to handle a "rollover" <asp:Buttonin the code behind with C# with this kind of code: Button btn = Page.FindControl("Button" + numWidget) as Button; btn.Attributes = "document.all." + btn.ClientID + ".src = '/Images/blue.gif'";
0
7912
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...
0
7839
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8202
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. ...
0
8338
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...
0
8216
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...
1
5710
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...
0
5390
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...
0
3837
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...
1
2345
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

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.