473,386 Members | 1,610 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,386 software developers and data experts.

select input problem

107 100+
hey guys,

any idea why this doesnt work in IE:

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <script language="javascript">
  4. function add(){
  5.  
  6.     newoptions = "<option>1<option>2";
  7.     sel = document.getElementById('myselect');
  8.     sel.innerHTML += newoptions;
  9.  
  10. }
  11. </script>
  12. </head>
  13. <body>
  14. <select id="myselect">
  15. </select>
  16.  
  17.  
  18. <a href="#" onclick="add();">add options</a>
  19. </body>
  20. </html>

Works with other browsers but IE is being its awkward little self!

cheers


Andy
Jul 10 '08 #1
4 1114
hsriat
1,654 Expert 1GB
Appending the code with innerHTML won't work in IE.

See this example.
Jul 10 '08 #2
theS70RM
107 100+
ah ok thanks.

God i love IE. why cant it just do both like all the others!
Jul 10 '08 #3
acoder
16,027 Expert Mod 8TB
Even the add() method is not supported properly which is why you need a try/catch. You could also use the options array to add options:
Expand|Select|Wrap|Line Numbers
  1. selObj.options[i] = opt;
Jul 10 '08 #4
theS70RM
107 100+
how do they get away with makes peoples lives such hard work!?!?

I've made an app and everything i've done has worked perfectly in firefox no questions, but IE bitches and moans all the way, and it doesn't even help you debug... "error on page".... yea but where?!!
Jul 10 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: JT | last post by:
I have an input form for which I've created a "matrix" for user input. Basically, the user chooses a radio button and then through javascript, a select box is displayed to define a value for that...
1
by: Covad | last post by:
Hi all, For some reason my change() function is only called when the page loads. I'd much rather it gets called when the select changes. Here's the code: window.onload = init; function...
7
by: | last post by:
I can't get IE 6 to read the values in my <SELECT..> data entry fields. Netscape 7 and Opera see them, and IE will pass the values to the database, but the javascript validation script gets a null...
4
by: bobsawyer | last post by:
I've been building a series of SELECT lists that are populated dynamically using HTTPRequest. Things are going pretty well, and I've got the whole thing working flawlessly in Mozilla/Firebird....
11
by: Michi Henning | last post by:
Hi, I'm using a blocking Select() call on a socket with a timeout value of -1. I'd expect the call to block indefinitely, but it doesn't. When I use Poll() instead, a timeout of -1 works fine...
3
by: imrantbd | last post by:
This is my first problem.Please help me. I have the following code: <head> <script language="JavaScript"> function addSrcToDestList() { destList1 = window.document.forms.destList; srcList...
1
by: robin1983 | last post by:
Hi to all, i m newer to this site and fresher in Ajax world. Actually i get a problem while accessing data from Database. I have a combo box in my pages. Actually i want to access data from the...
1
by: volynetsv | last post by:
Hello. I have a small problem, here's code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html...
2
by: viki1967 | last post by:
Hi everyone. My form page htm: <html> <head> <script language="javascript"> function controlla_combo() { document.form1.Nacionalidad_text.disabled =...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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,...
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...

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.