473,769 Members | 2,345 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

onclick event not working in IE7

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 "test" link
which works fine in IE7. Do you know what may be the cause? Here's the
snippet:

// Works:

<select>
<option onclick="showdi v('bataille')"> La Bataille de Tchernobyl</
option>
<option onclick="showdi v('soleil')">So leil</option>
<option onclick="showdi v('catastrophe' )">La Catastrophe de
Tchernobyl</option>
<option onclick="showdi v('vingt_ans')" >Tchernobyl, Vingt Ans
Après</option>
</select>

// Doesn't work:

<a href="#" onclick="showdi v('soleil')">te st</a>

Thanks in advance,

Charles.

Oct 7 '07 #1
20 3176
Thanks guys. I fixed the problem using the <selectelemen t as
suggested.

Charles.

Oct 7 '07 #2
Charles wrote:
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 "test" link
which works fine in IE7. Do you know what may be the cause? Here's the
snippet:

// Works:

<select>
<option onclick="showdi v('bataille')"> La Bataille de Tchernobyl</
option>
<option onclick="showdi v('soleil')">So leil</option>
<option onclick="showdi v('catastrophe' )">La Catastrophe de
Tchernobyl</option>
<option onclick="showdi v('vingt_ans')" >Tchernobyl, Vingt Ans
Après</option>
</select>

// Doesn't work:

<a href="#" onclick="showdi v('soleil')">te st</a>

Thanks in advance,

Charles.
Put the onclick= call in the <selectstatemen t. That works. Its an
IE6/7 feature IIRC.

Oct 7 '07 #3
On Oct 7, 12:44 pm, Charles <landema...@gma il.comwrote:
Thanks guys. I fixed the problem using the <selectelemen t as
suggested.

Charles.
Seems to me that the change event would be more appropriate and
accessible than the click event.

Oct 7 '07 #4
David Mark wrote:
On Oct 7, 12:44 pm, Charles <landema...@gma il.comwrote:
>Thanks guys. I fixed the problem using the <selectelemen t as
suggested.

Charles.

Seems to me that the change event would be more appropriate and
accessible than the click event.
MM. Until, as I discovered, you end up with only one option, that can't
ever be changed..;-)
Oct 8 '07 #5
Lee
The Natural Philosopher said:
>
David Mark wrote:
>On Oct 7, 12:44 pm, Charles <landema...@gma il.comwrote:
>>Thanks guys. I fixed the problem using the <selectelemen t as
suggested.

Charles.

Seems to me that the change event would be more appropriate and
accessible than the click event.
MM. Until, as I discovered, you end up with only one option, that can't
ever be changed..;-)
In that case, you've coded it wrong.
A selection list should never have only one option, and it's
trivial to ensure that this never happens.
--

Oct 8 '07 #6
Lee wrote:
The Natural Philosopher said:
>David Mark wrote:
>>On Oct 7, 12:44 pm, Charles <landema...@gma il.comwrote:
Thanks guys. I fixed the problem using the <selectelemen t as
suggested.

Charles.
Seems to me that the change event would be more appropriate and
accessible than the click event.
MM. Until, as I discovered, you end up with only one option, that can't
ever be changed..;-)

In that case, you've coded it wrong.
A selection list should never have only one option, and it's
trivial to ensure that this never happens.

I am not gong to reiterate the reasons why it was intended to be that
way, was not coded wrong, and works perfectly.

The readiness with which people claim righteousness in here and
elsewhere sometimes makes me want to vomit.

There is not sch thing as coded wrong. There is stiff that works as
intended, and stuff that doesn't work as intended. If it works as
intended, how can it be coded wrong?
Oct 8 '07 #7
On Oct 8, 4:00 pm, The Natural Philosopher <a...@b.cwrot e:
Lee wrote:
The Natural Philosopher said:
David Mark wrote:
On Oct 7, 12:44 pm, Charles <landema...@gma il.comwrote:
Thanks guys. I fixed the problem using the <selectelemen t as
suggested.
>>Charles.
Seems to me that the change event would be more appropriate and
accessible than the click event.
MM. Until, as I discovered, you end up with only one option, that can't
ever be changed..;-)
In that case, you've coded it wrong.
A selection list should never have only one option, and it's
trivial to ensure that this never happens.

I am not gong to reiterate the reasons why it was intended to be that
way, was not coded wrong, and works perfectly.
It was coded wrong as you intended it to "work" incorrectly. Refer
back to the original thread.

Oct 8 '07 #8
Lee
The Natural Philosopher said:
>
Lee wrote:
>The Natural Philosopher said:
>>David Mark wrote:
On Oct 7, 12:44 pm, Charles <landema...@gma il.comwrote:
Thanks guys. I fixed the problem using the <selectelemen t as
suggested .
>
Charles.
Seems to me that the change event would be more appropriate and
accessible than the click event.

MM. Until, as I discovered, you end up with only one option, that can't
ever be changed..;-)

In that case, you've coded it wrong.
A selection list should never have only one option, and it's
trivial to ensure that this never happens.

I am not gong to reiterate the reasons why it was intended to be that
way, was not coded wrong, and works perfectly.

The readiness with which people claim righteousness in here and
elsewhere sometimes makes me want to vomit.

There is not sch thing as coded wrong. There is stiff that works as
intended, and stuff that doesn't work as intended. If it works as
intended, how can it be coded wrong?
Easily. If the way in which it is coded is a perversion of the
way the browser elements were intended to be used, that's a
pretty good sign that it's coded wrong. The fact that it works
the way you intended it to work doesn't make it right. At best
it moves the mistake from your coding to your design.

Making people click on select controls as if they were buttons
is bad user interface design. Period. I don't say that out of
self-righteousness, but based on years of user interface design,
including dealing with user feedback, user support, and updates
to the code.

Particular in browser environments, trying to make controls behave
other than as they were designed to is almost always a mistake.
It's too likely that the next browser release or some browser that
a client insists on using won't support whatever hacks you have to
use to get the behavior you want.

Even if you think you know your user base, you have to consider
that user bases change. The company that uses strictly IE may
hire somebody who requires a special browser to accommodate some
disability or the CIO may play a round of golf with somebody who
argues convincingly for Opera.
--

Oct 8 '07 #9

"The Natural Philosopher" <a@b.cwrote in message
news:11******** ********@proxy0 0.news.clara.ne t...
Lee wrote:
>The Natural Philosopher said:
>>David Mark wrote:
On Oct 7, 12:44 pm, Charles <landema...@gma il.comwrote:
Thanks guys. I fixed the problem using the <selectelemen t as
suggested .
>
Charles.
Seems to me that the change event would be more appropriate and
accessible than the click event.

MM. Until, as I discovered, you end up with only one option, that can't
ever be changed..;-)

In that case, you've coded it wrong.
A selection list should never have only one option, and it's
trivial to ensure that this never happens.

I am not gong to reiterate the reasons why it was intended to be that way,
was not coded wrong, and works perfectly.

The readiness with which people claim righteousness in here and elsewhere
sometimes makes me want to vomit.

There is not sch thing as coded wrong. There is stiff that works as
intended, and stuff that doesn't work as intended. If it works as
intended, how can it be coded wrong?
One of the hard lessons is that just because it works, it does not mean it
is right.

The harder lesson is that "not right" can have a fearsome bite.

If you have not learned that, I hope your luck holds.
Oct 8 '07 #10

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

Similar topics

4
3664
by: masantha wee | last post by:
Hi all, I am using Firefox and embedding Javascript in html. I understand that we can use mouse events by coding them in the body of html (by creating a button or anything and by adding in the events in the <img> tag). <input id="StdDev Value" name="StdDevButton" type="button" value="Standard Deviation Value" onclick="readStdDevValue()"/>
1
9664
by: Chris Soulsby | last post by:
Hi, I have a control that contains a embedded ie control. I used the following code to add a onclick event to a table element: IHTMLDocument2 oIHTMLDocument2 = (IHTMLDocument2)m_oWebBrowserControl.Document; mshtml.HTMLTableClass oHTMLElement = (mshtml.HTMLTableClass)oIHTMLDocument2.all.item(strObjectName, null); ((mshtml.HTMLTableEvents2_Event)oHTMLElement).onclick += oEventHandler;
5
2587
by: moondaddy | last post by:
I have a <a> element in a datagrid which wraps some asp.net labels. this element also has an onclick event which does not fire in netscape 6 (and perhaps other browsers for all I know...). Below is the code for this. the onclick event calls a javascript function which I put an alert in the firt line to tell me if its working. It does work in IE. Any ideas on how to get netcrap... oops, I'm sorry, netscape to fire the onclick event? ...
5
2131
by: Fred.Grieco | last post by:
Hi every body, I have a little pb and I'm turning around : function MyFCTN(var1,var2) { var mytable = document.getElementById("myTBL"); for (var i=myTBL.childNodes.length-1; i>0; i--){ myTBL.removeChild(myTBL.childNodes); } for(var i=0; i<var1.length; i++){
11
3033
by: GaryB | last post by:
Hi Guys, I've been battling with this one for hours - I hope that you can help me! My code modifies the <aon a page, from a standard document link into a link with a tailored onclick event. It works perfectly (assigning the correct images and the correct onclick events to the correct <atags):
2
2083
by: moondaddy | last post by:
I have an asp.net 2.0 application and put a html button on a web page. I double clicked on the button and it crated the event handler for me and created the stub js function for it like this: <input id="btnQryFunctions" type="button" value="Query Functions" language="javascript" onclick="return btnQryFunctions_onclick()" /> and the function it created was: function btnQryFunctions_onclick() {
5
13963
by: Stuart Shay | last post by:
Hello All I am working on ASP.NET 1.1 Custom Pager that allows a User to Enter a Number in a TextBox and go to the page selected. Since the OnClick Event does not work in ASP.NET 1.1 for a TextBox I want to use a hidden button to fire when the Onclick Event is fired for the TextBox.
5
2107
by: Magician | last post by:
Hello. I am trying to set the onclick event for images through a function, but the event is triggered as soon the page loads, then will not work when the image is clicked. Can anyone suggest what is wrong? It is happening in both IE6 and Firefox --------------------------------------------------------------------------- window.onload = fnNewWindowLinks; function fnNewWindowLinks() { for (var intLinks=0; intLinks<document.links.length;...
2
18564
by: =?Utf-8?B?TWFyaw==?= | last post by:
I am writing a control and want to handle an OnClick event on the client-side before then conforming to the postback mechanism. I have got the server-side events working for my OnClick event by adding to the rendered element's OnClick handler using GetPostBackEventReference. How can I provide a client-side onclick handler and then to use the aspnet form submit method such that I can also subscribe to the server-side events too?
18
3942
by: joaotsetsemoita | last post by:
Hello everyone, I'm having troubles assigning an onclick event to a cell. Im trying something like cursorPoint.cells.style.cursor = "hand"; cursorPoint.cells.width = "20"; cursorPoint.cells.onclick = "alert('this is a test');" cursorPoint.cells.alt = "Select the columns"; cursorPoint.cells.innerHTML = "&nbsp;"
0
10222
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
10050
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
9999
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
9866
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
7413
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
5310
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...
1
3967
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
2
3570
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
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.