There are two getElementById bugs up for discussion:
1. getElementById is case-insensitive but it should be case-sensitive.
2. getElementById searches NAME attributes as well as ID attributes but it should not.
My tests show that IE 6 and down have both bugs, Opera 9.02 has bug #2, Opera 7.54 has neither bug, and FireFox 1.5.0.7 has neither bug.
My proposed solution relies on something I noticed while testing in IE: "document.all" is case-sensitive altho it too searches NAME as well as ID attributes.
I would really appreciate if some different people could help me verify these findings in different browsers and on different platforms.
There has been another proposed solution - but I really don't like removing the ID attribute.
I'm trying to implement getElementsByClass() for the document object and the Element interface, that supposed to work for HTML, XHTML, SVG and MathML class attributes (including mixed namespace documents) and I have it working perfectly in Gecko (tested in Firefox 1.0.6 and Deer Park Alpha 2). I'm just having some serious problems with IE and a bug in Opera.
The test [1] is supposed to get a NodeList (an Array() with an item() method added) of elements by class name and then output an alert() containing the tagNames of the selected elements.
After a fair bit of testing, I believe the problem is occuring with the way I'm trying to attach the getElementsByClassName() and hasClassName() functions to elements in IE using an HTC. It seems to be breaking at the point within document.getElementsByClassName() where I call element.hasClassName (line 34 of the script [2]) but my understanding of this workaround using HTCs [3]] that I'm trying to use is very limited and I don't understand why it's breaking. Code:
We have a js heavy web-ui. In the production environment it runs minimized, composed from 10 or so js files. When we have a js-error of some sort (we have about 100 users and growing) we write the window.onerror information to a database. Only, it is not very helpful since linenumbers mean nothing in the intelligeble code.
Is there a minifier that tags the result that would allow translation of linenumbers? Is there some other method people use to solve this problem?
I got this Resize Image BBCode here. It is used for a Forum called Zetaboards, where I can just put it in my Admin Control Panel to make it work for my whole forum.What does the code do?With this BBCode, members are able to insert images to their posts and also are able to resize the images.[code]Can someone please help to make the code work correctly so the images are resized properly on Firefix, IE, and Google Chrome?
go to the "Jupiter" graphic on the top left, you'll see that I have a little tab at the bottom of that labeled "Physical". When you click on it, it slides out of the way, exposing a tab labeled "Orbital" and when you click on that one it slides out of the way and exposes a third tab labeled "Atmosphere". These all drive the little spec sheets above- though that's not where the problem lies.The problem is when instead of clicking on the exposed label, you click on the little sliver of the one right behind it, causing the other two tabs to do unintended things. Here's the code:
I want to restrict getElementById to search children of a specific element instead of searching the entire document, in the same way that I can do getElementsByTagName using a specific element as the parent.
In this particular instance the parent is a table and the elements I'm interested in are all TDs, so I did the basic getElementsByTagName('TD') off the table and looped through this array checking the IDs. However, I'm suspecting that the browser can do getElementById faster than I can do a loop in javascript. Is there a neater way to do this? For now, I'll settle for IE-only solutions, though it would be nice to have things work in generic browsers.
I keep getting an error stating "getElementById("ballElement") is null, but I have a div with that exact id. I have looked at the JS script before that line, but found no errors there either. Please take a minute to see if you find something.
I am trying to alter css using javascript as well as use the innerHTML function. I have pasted below 3 forms that access getElementById in slightly different ways (I wanted to rule out that it was the method.) All 3 work fine on IE but only work momentarily on Firefox. For example, one form has text that changes from red to black when the user clicks the button. In IE it changes. In Firefox it changes for a split second then goes back to black. Code:
I've been trying to follow the example from the sitepoint book on DHTML to change the href property of a link, but it doesn't work no matter what I try. Here's the code in the HTML file: Code:
Works fine in FF, Safari . . . but not with IE. The error is "Object doesn't support this property or method".I have narrowed it down to this line (and a few like it)name = escape(document.getElementById('name').value);The escape() is not the issue, same with or without.I am trying to capture the text value from the field with id='name'. I have found discussions about this problem with IE, but not a solution. This must be easy, just trying to get a cross browser solution to load a JS variable with an <input> value.
I came across a third party script I want to learn how to configure as well as learn more dhtml in the doing. I'm not much of a JS guy yet but I'm working on it.
This script works fine in IE6 but is a dead fish in FireFox. There is no support offered on the site where it came from.....
I have this annoying problem with netscape... I'm trying to access a form value by using getElementByID and in NS i end up with a null reference.
The following HTML is the form component that gives me headache: <form name='task' ...> .... <select name='prioritySelect' class='selectwidth'> <option value=''>Choose one</option> <option value=Ƈ'>Critical</option> <option value=ƈ'>High</option> <option value=Ɖ'>Medium</option> <option value=Ɗ'>Low</option> </select> .... </form>
And the related javascript code: if(document.getElementById("prioritySelect").disabled == false) { ... }
When digging into this I can get the desired information by using document.task.prioritySelect, but that should not be necessary, right?
I hope that anyone knows how to deal with this problem..
i am fairly new to javascript and XML. i'm trying to loop through some nodes and drop the output into a series of DIVs using getElementById. here's the code for that: Code:
I've built a table on the fly within a js function. In another function I'm trying to get the value of a cell in a particular row on that table. I've retrieved the cell object but cannot get it's value :
var claimDate = parent.expenseDisplay.document.getElementById("row"+lineNo+"Date");
now I thought that the following would give the the data var cdate = getObject(claimDate).value;
I cannot get the 2 getElementById functions to work and I am a beginner so I am sure it is something simple but I have not been able to fix it. I need to click on the text to change the font.
<?xml version = "1.0" encoding = "utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns = "http://www.w3.org/1999/xhtml">
I want to set up a large section page with perhaps as many as several hundred items showing thumbnail image, link to item page, and info in text about the item. The sections will be dynamically generated on the server side from a database of items. I need to be able to use JS to grab the content of selected DIVs into an array for disp[lay in a right column. So I am thinking to set up a JavaScript that can read an array of DIVs that have been selected by the user checking a checkbox within each individual one they want added to their collection. This MUST be done in JavaScript, not server side.
I might assign each a sequentially IDed DIV like <div id="itm1"> and <div id="itm2"> and so forth. Can I use wildcards both for CSS styling of an unknown number of DIVs and for reading reviewing an unknown number of them using getElementById?
I don't think getElementByTag will work because there are other DIVs I do not want, and GetElementByName won't work because Name is not a valid attribute for a DIV. Or should I assign each of the IDs a class, and use getElementsByClassName? What's the most logical appraoch?