mike.wright at mailinator.com
Fri Jun 20 23:10:59 UTC 2008
Mike Wright wrote:
> Bassel Safadi wrote:
>> On Sat, Jun 21, 2008 at 12:09 AM, Mike Wright wrote:
>>> html page below does not behave as expected?
>>> Below is the html being tested.
>>> <?xml version='1.0' encoding='UTF-8'?>
>>> <!DOCTYPE html
>>> PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
>>> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
>>> <p id='m'></p>
>>> <a id='a'></a>
>>> var d = document;
>>> var m = d.getElementById('m');
>>> var a = d.getElementById('a');
var a = d.getElementById('a').getAttribute('id');
gives me the 'id'. From there I can create the 'id' of the desired tag,
which solves my immediate problem.
I'm still curious as to why the <a> behaves differently???
>>> m.innerHTML = a;
>> var a = d.getElementById('a').innerText;
>> by the way adding href="" to the anchor tag will let var a =
>> d.getElementById('a'); return the href it self, if you still need an
>> that looks like:
>> [object HTMLanchorElement]
>> tell me and will find a work around for you...
> Thanks for your generous offer, Bassel.
> I need the node so I can use "nextSibling".
> As you pointed out "document.getElementById()" returns not the id, but
> the href. (That really puzzles me and differs from the O'Reilly books
More information about the users