I'm trying to get the href attribute from the base tag in the document
head. The following does not seem to work... any ideas what I'm doing
wrong?
if(!(document.g etElementsByTag Name) ||
!(basehrefs = document.getEle mentsByTagName( 'base')) ||
!(basehrefs.len gth) || !(basehrefs.len gth > 0) ||
!(basehrefs[0].getAttribute) ||
!(basehref = basehrefs[0].getAttribute(' href')) )
basehref = '';
This is essentially a very cautious version of:
basehref = doument.getElem entsByTagName(' base')[0].getAttribute(' href')
The big hairy if just provides checks to make sure everything can be
done and provide a contingency if it doesn't...
head. The following does not seem to work... any ideas what I'm doing
wrong?
if(!(document.g etElementsByTag Name) ||
!(basehrefs = document.getEle mentsByTagName( 'base')) ||
!(basehrefs.len gth) || !(basehrefs.len gth > 0) ||
!(basehrefs[0].getAttribute) ||
!(basehref = basehrefs[0].getAttribute(' href')) )
basehref = '';
This is essentially a very cautious version of:
basehref = doument.getElem entsByTagName(' base')[0].getAttribute(' href')
The big hairy if just provides checks to make sure everything can be
done and provide a contingency if it doesn't...
Comment