473,654 Members | 3,264 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

OnChange Javascript - IE vs Firefox

Hi Guys,

I'm having a HUGE problem with Javascript under IE, the code below belongs
to a page
http://filterqueen.brinkster.net/test.aspx

it works fine under Firefox, but not in IE...

does anyone knows how to add OnChange Script to work under IE as well?

-----------------------------------------
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArg s)
rbl.Attributes. Add("onchange", "javascript : alert('me :)');")
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Test Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:RadioButto nList runat="server" ID="rbl" RepeatDirection ="Horizontal ">
<asp:ListItem Value="1" Text="1" ></asp:ListItem>
<asp:ListItem Value="2" Text="2" ></asp:ListItem>
<asp:ListItem Value="3" Text="3" ></asp:ListItem>
</asp:RadioButton List>
</form>
</body>
</html>

-----------------------------------------

--

Bruno Alexandre
(a Portuguese in Københanv, Danmark)


Jun 12 '06 #1
7 8250
For one thing, your script is incorrect. You can remove the
"javascript :" portion.

Bruno Alexandre wrote:
Hi Guys,

I'm having a HUGE problem with Javascript under IE, the code below belongs
to a page
http://filterqueen.brinkster.net/test.aspx

it works fine under Firefox, but not in IE...

does anyone knows how to add OnChange Script to work under IE as well?

-----------------------------------------
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArg s)
rbl.Attributes. Add("onchange", "javascript : alert('me :)');")
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Test Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:RadioButto nList runat="server" ID="rbl" RepeatDirection ="Horizontal ">
<asp:ListItem Value="1" Text="1" ></asp:ListItem>
<asp:ListItem Value="2" Text="2" ></asp:ListItem>
<asp:ListItem Value="3" Text="3" ></asp:ListItem>
</asp:RadioButton List>
</form>
</body>
</html>

-----------------------------------------

Jun 12 '06 #2
nop...

You are wrong.

1st we need to supply the language, like if you wanna print the page you
scecified

<a href="javascrip t: window.print(); " >

and not only window.print(); ...

thans a W3C thing!
and secondly, even if I delete it still doesn't work :-(
--

Bruno Alexandre
(a Portuguese in Københanv, Danmark)
"Ray Booysen" <rj***********@ rjb.za.net> escreveu na mensagem
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
For one thing, your script is incorrect. You can remove the "javascript :"
portion.

Bruno Alexandre wrote:
Hi Guys,

I'm having a HUGE problem with Javascript under IE, the code below
belongs to a page
http://filterqueen.brinkster.net/test.aspx

it works fine under Firefox, but not in IE...

does anyone knows how to add OnChange Script to work under IE as well?

-----------------------------------------
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArg s)
rbl.Attributes. Add("onchange", "javascript : alert('me :)');")
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Test Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:RadioButto nList runat="server" ID="rbl"
RepeatDirection ="Horizontal ">
<asp:ListItem Value="1" Text="1" ></asp:ListItem>
<asp:ListItem Value="2" Text="2" ></asp:ListItem>
<asp:ListItem Value="3" Text="3" ></asp:ListItem>
</asp:RadioButton List>
</form>
</body>
</html>

-----------------------------------------

Jun 12 '06 #3
and one more...

it's ONLY FOR RadioButtonList ...

all my DropDownList are working perfectly with that syntax, in IE and
Fireworks!

--

Bruno Alexandre
(a Portuguese in Københanv, Danmark)
"Ray Booysen" <rj***********@ rjb.za.net> escreveu na mensagem
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
For one thing, your script is incorrect. You can remove the "javascript :"
portion.

Bruno Alexandre wrote:
Hi Guys,

I'm having a HUGE problem with Javascript under IE, the code below
belongs to a page
http://filterqueen.brinkster.net/test.aspx

it works fine under Firefox, but not in IE...

does anyone knows how to add OnChange Script to work under IE as well?

-----------------------------------------
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArg s)
rbl.Attributes. Add("onchange", "javascript : alert('me :)');")
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Test Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:RadioButto nList runat="server" ID="rbl"
RepeatDirection ="Horizontal ">
<asp:ListItem Value="1" Text="1" ></asp:ListItem>
<asp:ListItem Value="2" Text="2" ></asp:ListItem>
<asp:ListItem Value="3" Text="3" ></asp:ListItem>
</asp:RadioButton List>
</form>
</body>
</html>

-----------------------------------------

Jun 12 '06 #4
>> For one thing, your script is incorrect. You can remove the "javascript :"
portion.

nop...

You are wrong.

1st we need to supply the language, like if you wanna print the page you
scecified

<a href="javascrip t: window.print(); " >

and not only window.print(); ...

thans a W3C thing!

and secondly, even if I delete it still doesn't work :-(

--

Bruno Alexandre
(a Portuguese in Københanv, Danmark)


Not quite (as I see it):
A "href" usually has a URL in it, so it needs to be told that it
shouldn't redirect the browser to some URL, but execute a script
instead.
An "onclick" (onchange, onmouseover, onkeyup and other "on*"
attributes) doesn't redirect by itself, it is *designed* to execute a
script. That's why you don't need to tell it that it is javascript.

so :
<a href="javascrip t:alert('href') " onclick="alert( 'onclick')">X</a>
Hans Kesting
Jun 12 '06 #5
Bruno Alexandre wrote:
nop...

You are wrong.

1st we need to supply the language, like if you wanna print the page you
scecified

<a href="javascrip t: window.print(); " >

and not only window.print(); ...

thans a W3C thing!
and secondly, even if I delete it still doesn't work :-(

Have a look:

http://validator.w3.org/check?ss=1&v....net/test.aspx
Jun 12 '06 #6
got it...
but still, my problem remains...

but I follow the link that Ray sent and I found that the RadioList is
compiled as an SPAN tag, so that's why the JS didn't work, because onChange
is not valid under a span tag

from this:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArg s)
rbl.Attributes. Add("onChange", "alert('me :)');")
End Sub

I changed to this:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArg s)
Dim i As Integer
For i = 0 To rbl.Items.Count - 1
rbl.Items(i).At tributes.Add("o nChange", "alert('me :)');")
Next
End Sub

and now it works fine :-)
--

Bruno Alexandre
(a Portuguese in Københanv, Danmark)
"Hans Kesting" <ne***********@ spamgourmet.com > escreveu na mensagem
news:mn******** *************** @spamgourmet.co m...
For one thing, your script is incorrect. You can remove the
"javascript :" portion.

nop...

You are wrong.

1st we need to supply the language, like if you wanna print the page you
scecified

<a href="javascrip t: window.print(); " >

and not only window.print(); ...

thans a W3C thing!

and secondly, even if I delete it still doesn't work :-(

--

Bruno Alexandre
(a Portuguese in Københanv, Danmark)


Not quite (as I see it):
A "href" usually has a URL in it, so it needs to be told that it shouldn't
redirect the browser to some URL, but execute a script instead.
An "onclick" (onchange, onmouseover, onkeyup and other "on*" attributes)
doesn't redirect by itself, it is *designed* to execute a script. That's
why you don't need to tell it that it is javascript.

so :
<a href="javascrip t:alert('href') " onclick="alert( 'onclick')">X</a>
Hans Kesting

Jun 12 '06 #7
In IE onchange applies to INPUT TYPE=text, SELECT, and TEXTAREA.

Perhaps you need to use onpropertychang e instead?

--
Greg Collins [Microsoft MVP]
Visit Brain Trove ( http://www.BrainTrove.com )
Jun 12 '06 #8

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

Similar topics

8
7149
by: Mattias Campe | last post by:
Hello, On http://student.ugent.be/astrid/bewoners.php I got the problem that I want Javascript to let my browser go to http://student.ugent.be/astrid/bewoners.php?beginAcjaar=2002 when I select 2002-03 in the form in the upper right corner (idem dito for the other years). My form is composed by: <form method="post" action="bewoners.php">
4
11944
by: rick | last post by:
The following basic script works fine in firefox by not in IE. Can anyone spot the problem? In IE I can only delete the first line but not the lines created by javascript. Also, look at the HTML code for the first line (click the Table HTML button:)) you will fine that the code displayed is not the same as was written. "onChange" was changed to "onchange" etc. Please help. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">...
4
6114
by: Bart van Deenen | last post by:
Hi all I have a script where I dynamically create multiple inputs and selects from a script. The inputs and selects must have an associated onchange handler. I have the script working fine on Firefox, Safari and Konqueror, but the onchange event just doesn't fire on IE6. Firefox's javascript console shows no errors, and the IE script debugger shows nothing. onchange is not triggered.
5
3454
by: Pascal Batzli Jr | last post by:
Hello, I have a strange situation happening on the code below. When I first load the page, as I change any of the three combo boxes I have created, the onchange event is fired and the form should be submitted, but it isn't for some weird reason. However, after I press the ok button, it submits the form, and then the combo boxes start working normally. In IE, everything works fine. I appreciate any help. Thank you. <html>
3
3971
by: jab3 | last post by:
Hello. I"m new to this group, and to JavaScript in general, so please forgive me if I breach local etiquette. I'm trying to implement some client-side 'dynamic' validation on a form. I'm having a couple of problems, which I'll try to describe. But this e-mail will only reproduce one of them, in a "short" example. What I'm generally doing is having each form entry contained in a div, which as a label, an input with some event handlers,...
4
7733
by: David McNerney | last post by:
Would anyone be able to tell me why I get an error in FireFox 1.5.0.1 for MacOSX when I type some text and hit Enter in the following form: <html> <body> <form action="http://example.com" onSubmit="return false;"> <input type="text" name="samplenum" value="" onChange="alert('onChange fired');"> <input type="submit" name="cmd_submit" value="Submit" onClick="return false">
10
4928
by: david.bercot | last post by:
Hi, I have a big problem with a simple event : onchange !!! If I write this page : <html> <body> <form id="vu"> <input id="var01" name="var01" size="5" onchange="return false;"/> </form> </body>
7
20859
by: Tim Slattery | last post by:
I'm trying to handle the onChange event in an <input type="file"> element. In IE, there's no problem: the event fires when a file in the "open" box is doubleclicked, or the "Open" button in the box is clicked, or "Enter" is hit in the attached text box. I can get the value of the element. But in Netscape 7, onChange doesn't fire until focus leaves the element. When you double-click a file name or click "open" in the Open box, the...
21
29771
by: Leena P | last post by:
i want to basically take some information for the product and let the user enter the the material required to make this product 1.first page test.php which takes product code and displays prodcut anme have used ajax to avoid refreshing of page this works fine 2.now i have created one row with checkbox|select box|text|text|text|text| where in the select box values are fetched from table here also i have used ajax for getting the m_name...
0
8294
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8816
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
8709
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...
0
8596
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
6162
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
5627
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
4150
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
4297
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1924
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.