Hi,
I am using some Javascript to add images to blockquotes in IE6 & IE7 - because the pure CSS method does not work with them.
I used the code from here:
http://www.tjkdesign.com/articles/using_real_images_for_quotes_in_blockquotes.asp
<!--
function TJK_quote(){// v1.1.2 Copyright (c) 2006 TJKDesign - Thierry Koblentz
// use the same paths for: SRC and STYLE (filter) attributes
// set top padding values to match the height of your images
// you may style both images using CSS: blockquote img {...}
// or individually using classes: .q_O {...} and .q_C {...}
if (!document.getElementsByTagName || !document.createElement) return;
var z_Q=document.getElementsByTagName("blockquote");
for (var x=0;x<z_Q.length;x++){
var q_O = document.createElement('img');
q_O.alt="";
q_O.src="/img/q_O.png";
q_O.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true',src='/img/q_O.png')";
if (document.all) q_O.style.paddingTop="15px";
q_O.style.verticalAlign="text-bottom";
q_O.className="q_O";
var q_C = document.createElement('img');
q_C.alt="";
q_C.src="/img/q_C.png";
q_C.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true',src='/img/q_C.png')";
if (document.all) q_C.style.paddingTop="15px";
q_C.style.verticalAlign="top";
q_C.className="q_C";
z_Q[x].getElementsByTagName("p")[0].insertBefore(q_O,z_Q[x].getElementsByTagName("p")[0].firstChild)
z_Q[x].getElementsByTagName("p")[0].appendChild(q_C);
var z_URL=z_Q[x].getAttribute("cite");
if (z_URL){
var z_DIV = document.createElement('div');
var z_FROM = document.createTextNode("Quote from: ");
z_Q[x].appendChild(z_DIV);
z_DIV.className="q_D";
var z_A = document.createElement('a');
var z_DOMAIN = document.createTextNode(z_URL.slice(z_URL.indexOf("//")+2,z_URL.indexOf("/",9)));
z_A.href=z_URL;
z_A.appendChild(z_DOMAIN);
z_DIV.appendChild(z_FROM);
z_DIV.appendChild(z_A);
}
}
}
//-->
However, I am getting the following error message:
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET CLR 1.1.4322)
Timestamp: Wed, 19 Aug 2009 14:51:50 UTC
Message: ’getElementsByTagName(...).0’ is null or not an object
Line: 24
Char: 2
Code: 0
URI: http://xxxxx/assets/js/TJK_quote.js
I am no JavaScript expert - I’m not even a novice! So I’d appreciate any help you can give me in understanding and correcting this error.
Thanks,
Matt