Hi,
I have a query regarding the usage of document.getElementById() in FF. I was running the below code and document.getElementById() was returning a null in FF(version 3.5.7), but was working fine in IE
<input type="hidden" name="ProductName" id = "ProductName" >
<xsl:attribute name="value">
<xsl:value-of select="//Header/Terms/AdviceTrack" />
</xsl:attribute>
</input>
<input type="text" id="text1" value="abc"/>
<script language="JavaScript" type="text/javascript">
getElem(document,"ProductName");
<xsl:comment>
function getElem(
doc,id) {
if (doc.getElementById) {
return doc.getElementById(id);------->
This was returning a null on FF.
} else if (doc.all) {
return doc.all[id];
} else if (doc.layers) {
return doc.layers[id];
}else{
return null; // this is not happening
}
}
</xsl:comment>
</script>
Now i removed the 'name' attribute and it seems to be working fine on both the browsers:)
I wanted to know the reason behind this strange behaviour of FF? and
Why was it returning a null before?