Ok I'm having a problem trying to accomplish what I'm trying to do.
I have 5 tabs that when clicked on display information below them. However my problem is the tabs change when clicked on to a new bg image position. Here is my current function I coded:
Code:
function updateService(current_id) {
current_id_content = current_id+'_content';
var tabs = new Array(5);
tabs[0] = "s_design";
tabs[1] = "s_coding";
tabs[2] = "s_branding";
tabs[3] = "s_marketing";
tabs[4] = "s_multimedia";
for(x = 0; x < 5; x++) {
old_id = tabs[x];
content_id = old_id+'_content';
alert('Displaying: '+tabs[x]);
document.getElementById(tabs[x]).style.display = 'inline';
if (document.getElementById(content_id).style.display == 'inline') {
document.getElementbyId(tabs[x]).style.backgroundPosition = 'center';
document.getElementById(tabs[x]).style.borderBottom = '1px solid #cfcfcf';
document.getElementById(content_id).style.style.display = 'none';
document.getElementById(current_id).style.backgroundPosition = 'bottom';
document.getElementById(current_id).style.borderBottom = '0';
document.getElementById(current_id_content).style.display = 'inline';
return;
}
}
}
(Ignore the alert's it was for debugging purposes only)
I tried doing it that way because I'm not sure how I would loop through the elements of the main parent. (These are children in a parent container)
if there is, would it be: document.parentElement.div.style.display; ?
I'm not sure where to go with this.
Anyways, my problem with the above script is that it is treating them as a literal string instead of an actual id name.
__________________
Chris - Trying to help others and learn myself!
Please login or register to view this content. Registration is FREE
|