onchange event for Html select control not working in Firefox and netscape but working fine in IE and opera


I have the following code of select control  

<select id="cboState" onchange="distfill();" " >

 this onchange event is not firing in Firefox and netscape but working fine in IE and opera.

 

 

PLease tell me how can i resolve my problem.


RAGHAV

MVP ASP/ASP.Net Read My Blog


MARK THE POST AS ANSWER IF IT HELPS U.


"Success doesn't come to you…you go to it."--Marva Collins




"Success does not come to those who wait . . . and it does not wait for anyone to come to it." Anonymous


0
raghav_khunger
9/13/2008 10:03:05 AM
asp.net.client-side 24353 articles. 2 followers. Follow

4 Replies
1322 Views

Similar Articles

[PageSpeed] 20

Works for me. Maybe your problem is the extra quote mark that you have in <select id="cboState" onchange="distfill();" " > that should be <select id="cboState" onchange="distfill();">
 
NC...

0
NC01
9/13/2008 2:52:06 PM

The problem was different actually on change event was firing actually but

one thing was different for these browsers

ie.

 

i had 2 <select> controls on my page one is for filling states

and other combo was filling on change of state .

now in my java function i had written

these lines of code to add new option in second combo

newOpt = document.createElement("OPTION");

newOpt.text = distaccToStte[i].disname;

newOpt.value = distaccToStte[i].disvalue;

cboDist.add(newOpt, i + 1);

 

now the line cboDist.add(newOpt, i + 1); does not work for mozilla and netscape

so for this

i wrote

cboDist.appendChild(newOpt);

this work for netscape and mozilla

 

but by doing this my problem was that this now doesn't work for opera and IE 6.0

 

so to resolve that finally my sucessfull code was

var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);

if (win_ie_ver <= 6.0) {

var newOpt;

//cboDist.options.length = 1;

for (var i = 0; i < distaccToStte.length; i++) {

// alert('Hello in distfill for ');

newOpt = document.createElement("OPTION");

newOpt.text = distaccToStte[i].disname;

newOpt.value = distaccToStte[i].disvalue;

//cboDist.appendChild(newOpt);

cboDist.add(newOpt, i + 1);

}

}

else {var newOpt;

cboDist.options.length = 1;

for (var i = 0; i < distaccToStte.length; i++) {

// alert('Hello in distfill for ');

newOpt = document.createElement("OPTION");

newOpt.text = distaccToStte[i].disname;

newOpt.value = distaccToStte[i].disvalue;

cboDist.appendChild(newOpt);

//cboDist.add(newOpt, i + 1);

}

 

 

}

ie. i put two conditions that for I.E 6.0 and opera one condition follows and for mozilla and ntescape other follws.

 

Please mark as Answer if it Helps u.  

 


RAGHAV

MVP ASP/ASP.Net Read My Blog


MARK THE POST AS ANSWER IF IT HELPS U.


"Success doesn't come to you…you go to it."--Marva Collins




"Success does not come to those who wait . . . and it does not wait for anyone to come to it." Anonymous


1
raghav_khunger
9/15/2008 4:36:55 AM

This should work in all browsers:

<script type="text/javascript">
<!--
////////////////////////////////////////////////////////////////////////////////////////
// Usage:
// var elementRef = '<%= DropDownList1.ClientId %>';
// var optionText = 'New York';
// var optionValue = 'NY';
// addOption(elementRef, optionText, optionValue);
////////////////////////////////////////////////////////////////////////////////////////
function addOption(elementRef, optionText, optionValue)
{
 if ( typeof elementRef == 'string' )
  elementRef = document.getElementById(elementRef);

 if ( elementRef.type.substr(0, 6) != 'select' )
  return;

 var newOption = document.createElement('option');

 newOption.appendChild(document.createTextNode(optionText));

 if ( arguments.length >= 3 )
  newOption.setAttribute('value', optionValue);

 elementRef.appendChild(newOption);
}
// -->
</script>

NC...

0
NC01
9/15/2008 11:25:49 AM

Hi,NC01

U was right ,my above specified code was running correctly in mozilla,IE6.0,nescape,opera

but in IE 7.0 it was not working .

 

I tried ur code and now it is working with IE7.0 also

 

Thanks for ur support.Big Smile


RAGHAV

MVP ASP/ASP.Net Read My Blog


MARK THE POST AS ANSWER IF IT HELPS U.


"Success doesn't come to you…you go to it."--Marva Collins




"Success does not come to those who wait . . . and it does not wait for anyone to come to it." Anonymous


0
raghav_khunger
9/26/2008 5:00:28 AM
Reply:

Similar Artilces:

Cancelling client-side LinkButton OnClick event doesn't work in IE (but works in Firefox)
Hi, I have a number of LinkButtons in use on a site that might need to have their click events cancelled for some reason (client-side). I'm finding that the event isn't getting cancelled in IE7, but it does in Firefox.To see the problem in action:1) Visit http://www.yougodo.com/Home.aspx2) Type "ios" into the "Location:" search box3) CLICK the "Search for activities" button (do not press [enter] as this runs different client side code that works as it's not under the LinkButtons control)The client-side code should prevent the button from causing...

my IE Treeview client side event is not working in FireFox , Nescpe , Opera (It wokring well in Internet Explore)
Hi I am using client side script for select index change event of IE treeview It Work well in internet explore But Not Working in Other Browser like Nescap, FireFox or OperaCan u help me Treeview2.Attributes.Add("onselectedindexchange", "javascript:GetKeyValue()")Above code fire GetKeyValue (Client side function) when User chnage node Index...

Ajax working fine in Firefox but not working in IE
Hi Everyone!   I have a simple HTML page from where I am trying to send User name and Password through ajax to check credentials.  Its works first time fine in IE but after logging out from account and again on trying to login, control stays on same page itself. Its not getting to redirected to User home page even on entring correct details At the same time if I give wrong details, it will show corresponding error.   I am not understanding the problem, please someone help me with this issue.    For reference code is below: //calling login() from the pag...

Javascript Error in IE...Same script works fine in Netscape. What i need to change to make it work in IE?
function validCheck(frmObj){ var checkbox_choices = false; for (counter = 0; counter lifevision: function validCheck(frmObj){ var checkbox_choices = false; for (counter = 0; counter paste the complete functionMAKMark as Answer if this reply helps youMVP ASP/ASP.NetASP.Net Hosting : Host DepotMy Site : ASPSnippets place "var" before the variable counter: for (var counter = 0; counter < 10; counter ++){ }...

javascript (to control video) works in IE but not work in Firefox
Hi, I'm interested in synchronizing video with powerpoint slides. To control the video I use javascript but it does not work in FF. Here is the adress you can check. www.metu.edu.tr/~ari/smil When you click on an item below the video, the video should go to appropriate time. when you check it with IE it works fine but in FF it does not work. If anyone can help, I'll appreciate. Thanks _fatihari_ spoke thusly on 21/06/2006 8:57 AM: > I'm interested in synchronizing video with powerpoint slides. To > control the video I use javascript but it does not...

AJAX page not working with Firefox but works fine with IE
I have an AJAX enabled page that is working great in IE but in firefox, the hyperlinks and buttons within updatepanels are not clickable. This is very odd. There are no javascript errors on the page but in the status bar, a message is constantly displayed saying "transfering data from localhost.....". Does anyone have a clue what could be causing these problem. Update - I removed all of the AJAX update panels on the page and I still am unable to click any links or linkbuttons. The "tranfering data from localhost" message has also disappeared. This led me to believe that something was w...

IE Treeview Control Client Script on execute in FireFox and Opera (Urgent Client Side Rquirement)
Hi GaysI am using Treeview Control in my web application and use javascript coding at onselectedindexchange event of IE Treeview ControlIt will working well in Internet Explore But not Working in other one like FireFox or OperaMy usefull code for U as1) code for execute javascript function at when selected index of treeview2 control is change ( this code present in my .vb page) Treeview2.Attributes.Add("onselectedindexchange", "javascript:GetKeyValue()")2) now simple GetKeyValue Function available in Javascirpt ( which contiant code for getkeyvalue from treeview control current selected nod...

Button Click events in UpdatePanel are not working in Firefox but working in IE
Hi, I placed a button inside an Update Panel(asp.net 2.0 ajax control) as like this. <asp:UpdatePanel id="updt1" runat="server">   <ContentTemplate>      <table>       <tr><td> textbox1 here.. </td></tr>      <tr><td> textbox2 here.. </td></tr>      <tr><td> Submit Button here.. </td></tr>   </ContentTemplate> l</asp:UpdatePanel...

Not working in Netscape, working in IE
------=_NextPart_000_00F0_01C123EA.F9FFE0E0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello , The problem goes like this-=20 value of $mailids is coming from previous perl script=20 if($emailids eq ' ' || $emailids eq '@' || $emailids eq '.' || $emailids = !~ /..+/ ) { print <<"enter"; Content-type : text/html <html> <head><title>Search</title></head> <body> #####invokes the same perl script with the error = mess...

What work with IE does NOT work in FireFox
Name: Bill Schultz Email: altmailatbresnandotnet Product: Firefox Summary: What work with IE does NOT work in FireFox Comments: If you open http://www.allseeingeye.whatshisface.org in Internet Explorer and click on the links you will hear Audio Files play that are attached to the different web pages. You will also notice dissolve transitions between the pages. When you click on the 1st small eyeball you will see a form appear. Now run the same Web Site in FireFox. 1. No Audio. 2. No page transitions. 3. Instead of the form appearing, FireFox gives an error message. It...

Not working in Netscape, working in IE
------=_NextPart_000_0155_01C123E2.A6A692C0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello , The problem goes like this-=20 value of $mailids is coming from previous perl script=20 if($emailids eq ' ' || $emailids eq '@' || $emailids eq '.' || $emailids = !~ /..+/ ) { print <<"enter"; Content-type : text/html <html> <head><title>Search</title></head> <body> #####invokes the same perl script with the error = messag...

JavaScript Calendar Doesn't work in Firefox but works fine in IE
Hello, I am trying to implement a javascript based pop-up calendar in my web app and also add some ATLAS functionality. The calendar works fine in IE 6.0 but just pops-up in Firefox (ver 1.5.0.6) and does nothing else.  As soon as I remove the ATLAS Scriptmanager tag, and all other ATLAS update panels, it work fine.  Here is a sample of the page code without the ATLAS code:<%@ Page Language="VB" AutoEventWireup="false" CodeFile="MISys.aspx.vb" Inherits="MISys" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transit...

make dropdownlist onchange event work the same in IE and FireFox
I want the onchange event for a dropdown to work in IE the same as it works in Firefox.  The difference by default is that IE throws the onchange event every time the items are 'keyed' through.  Compare the two in IE and Firefox with this example:    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Untitled Page</title> <style type="text/css">...

OnClick button event dont work in IE, but works in Firefox?!?!?WHY? Help for a Solution, plz!
 Hi!I have a problem that hopefully someone can help me to find a solution, as soon as possible.I have a form where i have a button with an onclick event, but that event only works when i run the page (aspx) in FIREFOX. In INTERNET EXPLORER it doenst work. WHY?Well, i have a button where the client submit the data, like you can see above (i use framework 2.0) in page.aspx:<asp:Button ID="enviar" runat="server" Text="Enviar" UseSubmitBehavior="false" OnClick="enviar_Click" OnClientClick="if (!confirm('Confirma envio de dados?')) return;"/>In the code file (ASPX.VB), i have the envi...

Web resources about - onchange event for Html select control not working in Firefox and netscape but working fine in IE and opera - asp.net.client-side

JavaScript - Wikipedia, the free encyclopedia
programming styles. JavaScript was formalized in the ECMAScript language standard and is primarily used in the form of client-side JavaScript ...

OnFocus! OnBlur! OnChange! How I am going to learn how to code
I've been meaning to learn how to code beyond HTML for years now, but never have managed to do much more than borrow other people's cryptic code ...

CBC Television Series 1952 to 1982, A
A Is For Aardvark Wed 10:00-10:30 p.m., 7 Jul- 22 Sep 1954 Thu 10:30-11:00 p.m., 30Sep- 21 Oct 1954 A half- hour summer series, created, produced,and ...

DOTA2国际邀请赛全程比赛视频_新浪游戏看游戏_新浪游戏_新浪网
对抗游戏巨制Dota2于八月举行了国际邀请赛,邀请世界上各支著名Dota战队上演了精彩的Dota2大战,新浪看游戏特别推出Dota2邀请赛视频库,让你一次看个够。

閲嶈淇℃伅-閲嶅簡浜哄彛缃?/title>
鏈珯鎼滅储 浣滆€?/Option> 鏍囬 鍐呭 绠€浣?/A> 绻佷綋 璁句负棣栭〉 鍔犲叆鏀惰棌 鏀垮姟淇℃伅 鏈烘瀯鑱岃矗 淇℃伅鍏紑 閲嶈淇℃伅 宸ヤ綔淇℃伅 鍖哄幙淇℃伅 娉曞緥娉曡 閫氱煡鍏憡 澶т簨璁?/A> 鍔炰簨澶у巺 涓嬭浇涓績 璇佷欢鍔炵悊 琛屾斂瀹℃壒 ...

婀栧寳鐪佸叕瀹夊巺闂ㄦ埛缃戠珯骞冲畨鑽嗘缃?/title>
鐑偣鎺掕 鍏ㄧ渷487鍚嶆柊鐗硅缁撴潫鍩硅濂旇荡鍚勮嚜宀椾綅 鐪佸叕瀹夊巺鍓巺闀跨幇鍦烘寚鎸ラ珮绌烘晳浜?/a> 瀛熷缓鏌卞湪瑙傛懇鍏ㄥ浗鍏畨鐗硅澶х粌鍏垫垚鏋滄眹鎶ユ紨缁冨苟鍑哄腑鍏ㄥ浗鍏畨鐗硅闃熷缓璁惧骇璋堜細鏃跺己璋冩€荤粨缁忛獙鎶婃彙瑙勫緥 涓嶆柇鎻愬崌 ...

缃戜笂淇¤
... 蹇樿瀵嗙爜 鎮ㄥ綋鍓嶇殑浣嶇疆锛? 淇¤涓婚〉 淇¤鍏紑 鏍囬 鐣欒█鏃ユ湡 鎬绘暟 0 涓? - 棣?椤?涓婁竴椤? 涓嬩竴椤?鏈?椤点€€椤垫锛?font color=red> 0 /0椤点€€10鏉?椤点€€绗?select name='pagerNo' on ...

灞辫タ路楂樺钩-鍏紬鏈嶅姟
灞辫タ鏀垮簻缃?/a> 涓浗鏀垮簻缃?/a> 棣栥€€銆€椤?/a> 璧拌繘楂樺钩 璧勮涓績 缁勭粐鏈烘瀯 鍏氭斂棰嗗 鏀垮姟鍏紑 鎶曡祫鍒涗笟 楂樺钩鏃呮父 鍏紬鏈嶅姟 澶╂皵锛?/div> 11鏈?6鏃ュぉ姘斻€佺┖姘旀棩鎶?/a> 绔欏唴鎼滅储锛?/font> 棰嗗鑷磋緸 ...

2003 Acura CL Classifieds
To find a large selection of 2003 Acura CL used cars in the Automobile Magazine auto classifieds. Browse our vast inventory of used 2003 CL vehicles ...

Used Car Advanced Search - Automotive.com
Use our advanced search tool to view the used car classifieds at Automotive.com.

Resources last updated: 11/22/2015 6:28:19 PM