The code I've found to do this works brilliantly, however I cannot get the two codes to work together and they both need an onClick. I thought of making a function to do both, however I've hit a snag as the xcollapse uses an ID to show which element is to be collapsed.
The change text code:
[text]oldTextAry = new Array();
function changeText (fieldObj, newTexStr) {
if (newTexStr == fieldObj.innerHTML) {
fieldObj.innerHTML = oldTextAry[fieldObj.id];
} else {
oldTextAry[fieldObj.id] = fieldObj.innerHTML;
fieldObj.innerHTML = newTexStr;
}
}
[/text]
Code for the xcollapse:
[text][function xcollapse(id)
{
var ccommid = document.getElementById(id);
if(ccommid !== null) {
if(ccommid.style.display == 'block') {
ccommid.style.display = 'none';
}
else { ccommid.style.display = 'block';
}
}
}[/text]
The link I need it to go in:
<a onclick="xcollapse('X1492');return false; changeText(this,'+ E-BOOKS, DVDs, CDs & DOWNLOADS (Click to hide)');" style="font-size:12px; padding-left:8px; padding-top:9px; background-color:#897c67; color:#FFFFFF; display:block; height:25px;" href="#" id="text1link">+ E-BOOKS, DVDs, CDs & DOWNLOADS (Click to expand)</a>
(red is the change text, blue is the collapse)
Any hints on getting the two to work together?
Kind regards,
Aravona