473,486 Members | 2,407 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

the old JS question: IE vs Firefox

Hi guys,

I'm performing a form validation using the javascript in the ASPX pages and
I got into a part that I can't figure it out how to move foward.

All is resumed in this page:

http://filterqueen.brinkster.net/new...sers/test.aspx

the pages works like:
on DropDown change I pick up it's value and show it in the textbox
on Button click I add new numbers dynamically to the dropdown

1st Question:
Why does the onChange Dropdown work on IE and not in Firefox? (it's
simple Javascript!)
2nd Question:
Why can I grab the dropdown values having then from start, and then
when I add it dynamically I couldn't do it anymore?
so How can I have both questions working fine?

Thank you for all the help.
--

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


Jun 27 '06 #1
3 1546
Hi Bruno,

You can make the below changes in script, to get your condition work.

function show()
{

var index=document.getElementById("ddAvis").selectedIn dex;

document.getElementById("txtAvis").value =
document.getElementById("ddAvis").options[index].innerHTML;

}

function addOptions()

{

document.getElementById("txtAvis").value=" ";

var aa = new Array();

aa[0] = '';

aa[1] = '11';

aa[2] = '12';

aa[3] = '13';

aa[4] = '14';

for ( i=0; i<aa.length; i++ )

{

var myNewOption=new Option(aa[i],' ');

document.getElementById("ddAvis").options[i]=myNewOption;

}

}

Apply this changes and let me know if you have any doubts.

Regards,

Valli

(www.syncfusion.com)

ASP.Net FAQ:
http://www.syncfusion.com/faq/aspnet/default.aspx

Complete set of ASP.Net controls and components
http://www.syncfusion.com/toolsweb

"Bruno Alexandre" <br*********@gmail.com> wrote in message
news:up****************@TK2MSFTNGP02.phx.gbl...
Hi guys,

I'm performing a form validation using the javascript in the ASPX pages
and I got into a part that I can't figure it out how to move foward.

All is resumed in this page:

http://filterqueen.brinkster.net/new...sers/test.aspx

the pages works like:
on DropDown change I pick up it's value and show it in the textbox
on Button click I add new numbers dynamically to the dropdown

1st Question:
Why does the onChange Dropdown work on IE and not in Firefox? (it's
simple Javascript!)
2nd Question:
Why can I grab the dropdown values having then from start, and then
when I add it dynamically I couldn't do it anymore?
so How can I have both questions working fine?

Thank you for all the help.
--

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

Jun 27 '06 #2
Hi Bruno,
When you recreate the options on your select element, each value is left in
blank. Your javascript redefines the innerText only for each Option like
this:

<select name="ddAvis" id="ddAvis" onchange="show();" >
<option value=""></option>
<option value="">11</option>
<option value="">12</option>
<option value="">13</option>
<option value="">14</option>
</select>

So, if you change your function to:

function show() {
document.getElementById('txtAvis').value =
document.activeElement.children[document.activeElement.selectedIndex].innerText;
//alert(document.getElementById('ddavis').value);
}

Then it will work!!
cheers

Washington Moreira
(From Brazil)

"Bruno Alexandre" <br*********@gmail.com> wrote in message
news:up****************@TK2MSFTNGP02.phx.gbl...
Hi guys,

I'm performing a form validation using the javascript in the ASPX pages
and I got into a part that I can't figure it out how to move foward.

All is resumed in this page:

http://filterqueen.brinkster.net/new...sers/test.aspx

the pages works like:
on DropDown change I pick up it's value and show it in the textbox
on Button click I add new numbers dynamically to the dropdown

1st Question:
Why does the onChange Dropdown work on IE and not in Firefox? (it's
simple Javascript!)
2nd Question:
Why can I grab the dropdown values having then from start, and then
when I add it dynamically I couldn't do it anymore?
so How can I have both questions working fine?

Thank you for all the help.
--

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

Jun 27 '06 #3
thank you very much :)

I joined both example and so the final line is:

document.getElementById("ddAvis").options[document.getElementById("ddAvis").selectedIndex].innerText;

Thank you both once again :-)

--

Bruno Alexandre
(a Portuguese in Københanv, Danmark)
"Washington Moreira" <mo*****@dontspam.com> escreveu na mensagem
news:uD**************@TK2MSFTNGP03.phx.gbl...
Hi Bruno,
When you recreate the options on your select element, each value is left
in blank. Your javascript redefines the innerText only for each Option
like this:

<select name="ddAvis" id="ddAvis" onchange="show();" >
<option value=""></option>
<option value="">11</option>
<option value="">12</option>
<option value="">13</option>
<option value="">14</option>
</select>

So, if you change your function to:

function show() {
document.getElementById('txtAvis').value =
document.activeElement.children[document.activeElement.selectedIndex].innerText;
//alert(document.getElementById('ddavis').value);
}

Then it will work!!
cheers

Washington Moreira
(From Brazil)

"Bruno Alexandre" <br*********@gmail.com> wrote in message
news:up****************@TK2MSFTNGP02.phx.gbl...
Hi guys,

I'm performing a form validation using the javascript in the ASPX pages
and I got into a part that I can't figure it out how to move foward.

All is resumed in this page:

http://filterqueen.brinkster.net/new...sers/test.aspx

the pages works like:
on DropDown change I pick up it's value and show it in the textbox
on Button click I add new numbers dynamically to the dropdown

1st Question:
Why does the onChange Dropdown work on IE and not in Firefox?
(it's simple Javascript!)
2nd Question:
Why can I grab the dropdown values having then from start, and
then when I add it dynamically I couldn't do it anymore?
so How can I have both questions working fine?

Thank you for all the help.
--

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


Jun 27 '06 #4

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

Similar topics

19
1725
by: Mark Johnson | last post by:
Oddly enough, in searching Google for web and ngs, I could find only a handful of articles on this problem. I wonder if it's one not typically encountered? I wanted to have three divs that could...
2
5690
by: anna | last post by:
Firefox Mozilla Browser Fonts / Format / rich text / webmail question I have Comcast. They do not support Firefox so they won't help me. When I use Mozilla firefox browser to access my web...
7
1099
by: Frances Del Rio | last post by:
hello all, I have a question that is not striclty a JS question but figured folks here would know.. what IS the difference between Netscape and mozilla?? I have used both, they have the same...
7
1536
by: Tony A. | last post by:
Hi all, quick question: if I have two adjacent elements (e.g. <IMG> elements) without a <BR> inbetween, they will get rendered side by side if there is space in the window, as you'd expect....
3
2285
by: Jon Paal | last post by:
looking for insight on how to make this javascript solution firefox compatible. http://www.codeproject.com/useritems/HTMLFixedHeaders.asp any tips / insight would be helpful
12
1750
by: amit | last post by:
Hello group, I'm kinda skeptical about a code is being used in my js program. All it does is checking what browser is being run and finds out if FLASH is installed or not. This code works...
11
1331
by: Peter | last post by:
I'm new at this stuff -- so this is probably an incredibly dopey, newby question. Please bear with me. I don't know if it's a HTML or javascript question. (Or, if a different area altogether,...
30
4485
by: Takehiko Abe | last post by:
I have a <pelement with <ttinside: ;;; <p>A paragraph contains <tt>tt element</tt>.</p> I would like to set the font-size of the TT to the same as the containing <p>. This does not seem to...
2
2045
by: Jeff | last post by:
I've now searched the web for about 2+ hours and have found dozens of solutions, but none work. All information seems outdated and won't apply to Firefox 2.0. I'm trying to create the equivalent...
3
2536
by: Zhang Weiwu | last post by:
Hello! I wrote this: ..required-question p:after { content: "*"; } Corresponding HTML: <div class="required-question"><p>Question Text</p><input /></div> <div...
0
7100
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
6964
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...
0
7330
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...
0
5434
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
4559
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
3070
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...
0
1378
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 ...
1
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
262
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...

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.