473,782 Members | 2,479 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Browser Bugs, Quirks and Inconsistencies

acoder
16,027 Recognized Expert Moderator MVP
Don't you just hate it when you've got something working in every browser (that you've tested on) except the XYZ browser?

It would be a good idea to document some strange or incorrect behaviours of particular browsers with possible solutions and workarounds.

These will be documented in the following format:
Problem
Give a brief description of the problem

Browser
Which browser it affects (include version number if applicable)

Example
A simple example which demonstrates the problem

Solution
A possible solution or workaround which should not affect other browsers.

Alternative Solution (if applicable)
Another possible solution (if one exists).

Table of contents

Here's one to start us off:
-----------------------------------------------------------------------------------------------------
Problem
The select object's value property doesn't give the selected value

Browser
Internet Explorer

Example
The select drop down:
[HTML]<select name="test" id="test">
<option>1
<option>2
</select>[/HTML]
The Javascript code:
Expand|Select|Wrap|Line Numbers
  1. var selObj = document.getElementById("test");
  2. var val = selObj.value;
Solution
Give values to the option elements:
[HTML]<select name="test" id="test">
<option value="1">1
<option value="2">2
</select>[/HTML]
Alternative Solution
Change the Javascript to:
Expand|Select|Wrap|Line Numbers
  1. var selObj = document.getElementById("test");
  2. var val = selObj.options[selObj.selectedIndex].text;
Aug 18 '07 #1
9 11843
acoder
16,027 Recognized Expert Moderator MVP
The table row not getting added to the table in IE is a common problem. Well, here's the answer: add it to the tbody instead. Who would've thought IE would be so rigid?
Sep 2 '07 #2
acoder
16,027 Recognized Expert Moderator MVP
Two more bugs for IE's buggy (i.e. non-standard) implementation of the select element's add() method.
Sep 3 '07 #3
acoder
16,027 Recognized Expert Moderator MVP
IE doesn't respect "checked" property when dynamically adding checkboxes. Added to the list.
Sep 5 '07 #4
acoder
16,027 Recognized Expert Moderator MVP
Opera has a quirk relating to onload and onunload which may catch some people out. It's useful to know in case you have some functionality which is triggered by one of these two events. Oh yes, and two more IE bugs with many more to follow I'm sure.
Nov 1 '07 #5
cheogt
5 New Member
Problem
Not possible to prototype the Object() object
Browser
Internet Explorer
Example
The Javascript code:
Expand|Select|Wrap|Line Numbers
  1. //create an Alias (via protoype) for getElementById, or getElementByTagName
  2. Object.prototype.byTag=Object.prototype.getElementsByTagName;
  3. t=document.byTag('input');
Some relevant HTML:
Expand|Select|Wrap|Line Numbers
  1. <input id="anyName1" type="text" ...>
  2. <input id="anyName2" type="text" ...>
Solution
Create a simple function, and use the object as parameter (not nice!)... :
Expand|Select|Wrap|Line Numbers
  1. function byTag(o,s) {
  2.   return o.getElementsByTagName(s)
  3. }
  4. t=byTag(document,'input');
Nov 15 '07 #6
acoder
16,027 Recognized Expert Moderator MVP
Problem
Not possible to prototype the Object() object
Yes, but is it such a good idea? See Object.prototyp e is verboten (I don't know where the fascination with German words started!)
Dec 6 '07 #7
hsriat
1,654 Recognized Expert Top Contributor
Problem
Not able to use innerHTML for a dynamically created row.

Browser
Internet Explorer

Example
Expand|Select|Wrap|Line Numbers
  1. var rowX = tableObject.insertRow(tableObject.rows.length);
  2. rowX.innerHTML = '<td id="td01" class="cells" onclick="doSomething()">This is the cell</td>';
Solution
Use insertCell()
Expand|Select|Wrap|Line Numbers
  1. var rowX = tableObject.insertRow(tableObject.rows.length);
  2. var cellX = rowX.insertCell(0);
  3. cellX.id = "td01";
  4. cellX.className = 'cells';
  5. cellX.onclick = function () {
  6.     doSomething()
  7. }
  8. cellX.innerHTML = 'This is the cell';
May 14 '08 #8
acoder
16,027 Recognized Expert Moderator MVP
Problem
Not able to use innerHTML for a dynamically created row.
Spot on. However, if you're going to use insertRow(), most likely you'd use insertCell too. Good to know all the same. Thanks.
May 17 '08 #9
acoder
16,027 Recognized Expert Moderator MVP
Split out each one into their own page. Easier to read and link to.
Jun 8 '08 #10

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

Similar topics

1
6341
by: Nogusta123 | last post by:
Hi, I have had a lot of problems getting web pages, master pages and content pages to render in VS2005 design view the same as they would in Internet Explorer. I did a lot of looking on the internet for answers but didn't have much luck. Anyway I believe I have found the causes of the problems and thought I should share them in case any one else is feeling the pain and also to find out what other peoples opinions are, on whether these...
0
7349
acoder
by: acoder | last post by:
Problem The select object's add method doesn't append options to the end of the list. Browser Internet Explorer Example The Javascript code for appending an option element at the end of a select dropdown list: var opt = document.createElement("option"); opt.name = "optName";
0
12745
acoder
by: acoder | last post by:
Problem Dynamically appended checkbox element does not appear checked despite setting the checked property state to true or "checked". Browser Internet Explorer Example The Javascript code: var cb = document.createElement("input"); cb.type = "checkbox";
0
6937
acoder
by: acoder | last post by:
Problem The table, when appended dynamically, does not appear on the page. Browser Internet Explorer Example The Javascript code: var obj = document.getElementById("someObjectID"); var table = document.createElement("table");
0
11862
acoder
by: acoder | last post by:
Problem onload and onunload events do not fire when going back, forward or refreshing the page Browser Opera Example Any code using onload or onunload, e.g. window.onload = init; where init() is a function which initialises some variables (for example).
0
8252
acoder
by: acoder | last post by:
Problem When setting the FORM object's action property an "Object does not support this property or method" error occurs Browser Internet Explorer 6- Example The Javascript code: var theForm = document.getElementById("formID"); theForm.action = "actionpage.php";
0
7520
acoder
by: acoder | last post by:
Problem document.getElementById() selects an element by its name. Browser Internet Explorer Example Relevant HTML code: <input name="test" type="text" value="test"> The Javascript code:
10
3263
by: Conrad Lender | last post by:
In a recent thread in this group, I said that in some cases object detection and feature tests weren't sufficient in the development of cross-browser applications, and that there were situations where you could improve the application by detecting the browser vendor/version. Some of the posters here disagreed. Since then, I've had to deal with a few of these cases; some of them could be rewritten to use object detection, and some couldn't....
0
9639
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
9479
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10311
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
10146
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
10080
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
9942
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...
0
6733
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
5509
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4043
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

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.