JavaScript in XML?


would you explain to me why this JS test in an XML file doesn’t work?

<?xml version="1.0" ?>
<!-- <?xml-stylesheet type="text/css" href="main.css" ?> -->

<root xmlns="">

    <a:musicstore xmlns:a="">
            <a:name>Scenes from a Memory</a:name>
            <a:artist>Dream Theater</a:artist>

    <b:musicstore xmlns:b="">
            <b:artist>Allan Holdsworth</b:artist>

<script type="text/javascript">
document.getElementsbyTagName("year").innerHTML = "2000";


It is returning me this:

TypeError: undefined is not a function (evaluating 'document.getElementsbyTagName("year")')

Thank you!

See for the call to use to get the tag in XML.

Also innerHTML will not work when you don’t have HTML.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.