473,426 Members | 1,481 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,426 software developers and data experts.

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.dtd">
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs)
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:RadioButtonList 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:RadioButtonList>
</form>
</body>
</html>

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

--

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


Jun 12 '06 #1
7 8243
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.dtd">
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs)
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:RadioButtonList 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:RadioButtonList>
</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="javascript: 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****************@TK2MSFTNGP04.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.dtd">
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs)
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:RadioButtonList 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:RadioButtonList>
</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****************@TK2MSFTNGP04.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.dtd">
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs)
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:RadioButtonList 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:RadioButtonList>
</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="javascript: 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="javascript: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="javascript: 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.EventArgs)
rbl.Attributes.Add("onChange", "alert('me :)');")
End Sub

I changed to this:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Dim i As Integer
For i = 0 To rbl.Items.Count - 1
rbl.Items(i).Attributes.Add("onChange", "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.com...
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="javascript: 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="javascript: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 onpropertychange 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
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...
4
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...
4
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...
5
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...
3
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...
4
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"...
10
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>...
7
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...
21
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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
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
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,...
0
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
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
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...

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.