473,545 Members | 2,045 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

onclick event does not work with select option in IE

Hello,

I have a simple form

<form method="POST">
<select name="activity" >
<option value="0">None</option>
<option value="M" onclick="popup_ onclick()">Sele ct
Multiple</option>
<option value="1">Kayak ing</option>
<option value="2">Rafti ng</option>
<option value="3">Snowb oarding & Skiing</option>
<option value="4">Hikin g</option>
<option value="5">Trekk ing</option>
</select>
</form>

& my javascript code is

function popup_onclick() {
my_window = window.open
("",'windowname ','height=200,w idth=200');
my_window.docum ent.write("hell ow world");
my_window.docum ent.close();
}

When a user views the form it shows a dropdown menu for activities &
when she/he clicks on 'Select Multiple' option a new window should pop
up with words written 'hellow world' in it .
This works fine in Firefox 1.5 but it doesn't work in IE (Internet
Explorer) 6.

Anyone have any tips ? Can this be done in IE 6 ? Thanks!

Prashant Marne

Jan 18 '07 #1
7 33672

pr*********@gma il.com wrote:
Hello,

I have a simple form

<form method="POST">
<select name="activity" >
<option value="0">None</option>
<option value="M" onclick="popup_ onclick()">Sele ct
Multiple</option>
<option value="1">Kayak ing</option>
Hi,
Option element has no onclick event in IE. Use onchange event of select
element instead.

<select name="activity" onchange="if
(this.options[this.selectedIn dex].value=='M') popup_onclick() ;">
<option value="0">None</option>
<option value="M">Selec t Multiple</option>
<option value="1">Kayak ing</option>
......

Jan 18 '07 #2
marss,

thx for the reply. appreciate it. however, i'm a bit surprised why
internet explorer IE does not follow
the HTML specifications.

http://www.w3.org/TR/html401/interact/forms.html#h-17.6

it writes that the <OPTIONpart of the <SELECTelemen t does have an
intrinsic event of onclick.

thanks.

prashant marne.

---------------------------------------------------------------------------------------------------------------------------------------------------------
OPTION Attribute definitions

selected [CI]
When set, this boolean attribute specifies that this option is
pre-selected.
value = cdata [CS]
This attribute specifies the initial value of the control. If this
attribute is not set, the initial value is set to the contents of the
OPTION element.
label = text [CS]
This attribute allows authors to specify a shorter label for an
option than the content of the OPTION element. When specified, user
agents should use the value of this attribute rather than the content
of the OPTION element as the option label.

Attributes defined elsewhere

* id, class (document-wide identifiers)
* lang (language information), dir (text direction)
* title (element title)
* style (inline style information)
* disabled (disabled input controls)
* onclick, ondblclick, onmousedown, onmouseup, onmouseover,
onmousemove, onmouseout, onkeypress, onkeydown, onkeyup (intrinsic
events)
---------------------------------------------------------------------------------------------------------------------------------------------------------
marss wrote:
pr*********@gma il.com wrote:
Hello,

I have a simple form

<form method="POST">
<select name="activity" >
<option value="0">None</option>
<option value="M" onclick="popup_ onclick()">Sele ct
Multiple</option>
<option value="1">Kayak ing</option>

Hi,
Option element has no onclick event in IE. Use onchange event of select
element instead.

<select name="activity" onchange="if
(this.options[this.selectedIn dex].value=='M') popup_onclick() ;">
<option value="0">None</option>
<option value="M">Selec t Multiple</option>
<option value="1">Kayak ing</option>
.....
Jan 18 '07 #3
ASM
pr*********@gma il.com a écrit :
i'm a bit surprised why
internet explorer IE does not follow
the HTML specifications.

http://www.w3.org/TR/html401/interact/forms.html#h-17.6

it writes that the <OPTIONpart of the <SELECTelemen t does have an
intrinsic event of onclick.
and what does mean "intrinsic" for you ?

clicking on an option intrinsically changes selectedIndex

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Jan 18 '07 #4
ASM wrote:
pr*********@gma il.com a écrit :
i'm a bit surprised why
http://www.w3.org/TR/html401/interact/forms.html#h-17.6

it writes that the <OPTIONpart of the <SELECTelemen t does have an
intrinsic event of onclick.

and what does mean "intrinsic" for you ?

clicking on an option intrinsically changes selectedIndex
Not necessarily. The option in question might be already selected when
clicked.

--
Bart

Jan 18 '07 #5
ASM
Bart Van der Donck a écrit :
ASM wrote:
>>
clicking on an option intrinsically changes selectedIndex

Not necessarily. The option in question might be already selected when
clicked.
and ?

onclick changes selectedIndex to the same one :-)

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Jan 18 '07 #6
ASM wrote:
Bart Van der Donck a écrit :
ASM wrote:
>
clicking on an option intrinsically changes selectedIndex
Not necessarily. The option in question might be already selected when
clicked.

and ?

onclick changes selectedIndex to the same one :-)
The verb "to change" semantically means "to become different, or to
make different". A statement "change to the same" thus contradicts in
its terms by definition.

--
Bart

Jan 18 '07 #7
ASM
Bart Van der Donck a écrit :
ASM wrote:
>onclick changes selectedIndex to the same one :-)

The verb "to change" semantically means "to become different, or to
make different". A statement "change to the same" thus contradicts in
its terms by definition.
Don't think browsers think so far and
onclick=change ==onclick = change to what asked
(even if not different)

But the way to change is not very important as soon as the result is
what was expected.
(any way last post was a joke and in previous one I used 'change' to
point to select's event 'onchange' doing an intrinsic parallel)

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Jan 18 '07 #8

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

Similar topics

5
10762
by: Jim Bond | last post by:
Hello, I have found myself in the position of having to manage & "hack" a web site built by someone else. I am trying to make a modification to the javascript code and have been unable to get this working. I admit that I am a total javascript beginner, but have read google & purchased the o'reilley javascript book. So far, all I've been...
6
16812
by: Hal Vaughan | last post by:
I'm using KDE on Linux, with Konqueror as the testing browser for this project. I've recently upgraded, so I realize some of the bugs I'm dealing with may or may not be my program, and could also result from me being less than perfect in my preliminary coding on test pages. I had an <OPTION> element, 10 lines in size. Previously I used: ...
12
8862
by: Forti2ude | last post by:
Hello, I have a simple form... <form> <select name="foo" multiple> <option value="1">one</option> <option value="2">two</option> <option value="3">three</option> </select>
2
20498
by: abs | last post by:
Hi all. Is that possible to call the onclick, onchange or other event from JS ? I mean how to make the browser think that user clicked the element (onclick event) ? Eg. I have <element onclick='myFunction()'> and I don't want to call the myFunction() by writing its name in the code but I want to call the onclick event without clicking :) I...
17
10168
by: dan_williams | last post by:
I have the following test web page:- <html> <head><title>Test</title> <script language="Javascript"> <!-- function fnTR() { alert("TR"); }
3
6480
by: Michael_R_Banks | last post by:
I'm trying to dynamically build a table that allows users to remove rows when they click a corresponding button. For some reason, whenever I add the button to the table, it never fires the onclick event. I'm stumped with this one, any assistance would be appreciated. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://...
20
3113
by: Charles | last post by:
Hello, On my web site, I have a <selectdrop-down menu that allows to show/ hide divs: http://tchernobyl.dreamhosters.com - The problem is that it doesn't work in IE7 (only tested in Opera and Firefox). However, if I include the onclick event in an <atag, it works fine in IE (but not within <optiontags). Next to the drop-down menu, I put a...
2
2738
by: DavidGeorge | last post by:
In an earlier thread I recounted a problem I was having, but it took a while to reduce the problem to it's basic components and the issue became somewhat confused in reaching that point. I hope you will excuse me for bringing it up again but this issue is very frustrating. I created a new form in a brand new (Access 2003) database. This...
0
7473
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
7408
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
5976
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5340
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
4949
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
3458
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
1891
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
1
1020
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
712
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...

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.