473,808 Members | 2,797 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HTML updating dropdown menu, not working for IE8

2 New Member
Hi
My code used to work in IE6, but no longer in IE8.
When the radio button is selected it should replaced Saab with Porsche.
Instead I get "Object doesn't support this propert or method" error.
I think I have narrowed the problem to this bit...

Expand|Select|Wrap|Line Numbers
  1. </html>
  2. <script>
  3. function reportOptions (repnum) {
  4.     myfrm.mydrop.options[1] = Option("Porsche");
  5. }
  6.  
  7. </script>
  8.  
  9. <form id="myfrm">
  10. <br/>
  11. <td colspan=6>
  12.  
  13. <input type="radio" id="idrep1" name="Reptype" onClick="reportOptions(1)">
  14. <label for="idrep1">Upgrade</label></body>
  15.  
  16. <select id="mydrop">
  17.   <option>Volvo</option>
  18.   <option>Saab</option>
  19.   <option disabled="disabled">Mercedes</option>
  20.   <option>Audi</option>
  21. </select>
  22.  
  23. </html>

Any help is appreciated
Thanks
Rodney
Sep 24 '10 #1
2 2597
RamananKalirajan
608 Contributor
This is actually a script question... The poblem is you have to specify what you want to change either text or value and try to use document.getEle mentById instead of accessing by form name.

Expand|Select|Wrap|Line Numbers
  1. function reportOptions (repnum) {
  2. document.getElementById("mydrop").options[1].text = "Porsche";
  3. }
still there are some flaws in ur code. In HTML opening tag you hav added slash. Script should be inside HEAD tag.

Thanks and Regards
Ramanan Kalirajan
Sep 24 '10 #2
Geckomin
2 New Member
Thanks, simply changing to the below worked :-)

myfrm.mydrop.op tions[1] = new Option("Porsche ");
Sep 27 '10 #3

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

Similar topics

1
2330
by: LG | last post by:
I have asked before but I did not get all the answer I wanted. Perhaps I explained too bad. I have my site in frames, and the dropdown list is in the 'left' frame, and I have used javascript so that when you click on the selected word in the dropdown menu, it automatically opens up an URL. I want it to open up in the right frame. As it now opens in the 'left' frame. I know you can do it with target in html. But I want it open up the...
5
1595
by: michael | last post by:
How may the following script be modified to function with the list structure below it? In short: it is meant to apply a background style to groups of LI's and ULs depeding on the URL filename. <style> ..high {background-color: #99FFCC;} ..low {background-color: #33CC00;} </style>
4
4961
by: Tim | last post by:
Hi, I've been searching the web for hours now and found lots and lots of javascript files with which you can create dropdown menu's, but with all of them you have to specify the width of the menu-items. This is not exactly to my liking because you have to set the width according to the text in the menu-items. Now, when working width a fixed font size, this goes fine, but that's not exactly what I want. If people have the standard font...
3
2131
by: ACaunter | last post by:
Hi there, can someone please tell me what the easiest way to have a dropdown menu bar positioned on the screen (eg. Home, company, ... , contact us) then when the mouse goes over then, the sub menu options are displayed thanks a lot -- AdamPC@hotmail.com
6
2339
by: adz1809 | last post by:
I have created this horizontal dropdown menu in css which is working fine in IE6+ but isn't firefox, and I have no idea why. here is the code: HTML: <body id="our-travels" class="home"> <div id="header"> <h1>Header</h1>
0
1523
by: temp304 | last post by:
Customize Dropdown Menu is designed to display some choices, as: languages, countries, themes,... but it's differrent from original version in browsers. This tool combine CSS and JavaScript to create a dropdown you can add image to tilte, every choice. Version 2: check if JavaScript is disabled, then add normal dropdown menu Let's try dropdown below and feel differences. Tested: IE 7, Opera 9, Firefox 2, Netscape 8. Demo:...
1
2858
SHOverine
by: SHOverine | last post by:
Recently my web host decided to "upgrade". This change rendered many of my pages useless and I am scrambling to fix the issues, so you may see several posts from me in the coming days. My first issue is that all of my dropdown menus are passing the last row to the next page as the session variable. The pages that I am talking about can be found at: Weekly13_Test The code that follows was operational until the change. Here is my...
2
1810
by: Nickol77 | last post by:
I created a web page in Dreamweaver using their dropdown menu utility, I converted the page to HTML to XHTML. the dropdowns works fine in IE, but not Firefox? Help! http://www.xalexweb.com/sm/candidate3.html
19
3716
by: Jim | last post by:
Hi, I have two questions/problems pertaining to CSS horizontal dropdown menus and am hoping that someone here can help me out. (1) I'm having a problem centering the menu. I picked up the code for this from a tutorial but that menu was flush-left justified. Not what I want. Subsequent searches on google on how to center yielded a
2
3755
by: neovantage | last post by:
Hey all, I have integrated UL, Li base dropdown menu but it is bevaing abnormal in IE. Can somebody have a look on my code and help me out to fix the problem. Here is the Link of my website. *Note: It is working fine in Safari and Firefox Mozilla but creating problem in IE And here is the HTML code. <span class="preload1"></span> <span class="preload2"></span>
0
9721
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10628
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
10373
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
10374
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
9195
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6880
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5547
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...
0
5685
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3859
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.