The login affects this because it introduces a new element, the Edit anchor and because my code relied strictly on the structure of a non-login page it references the wrong anchor. Therefore the solution is to update this line in my JS:
I switched the + indicator with an image and the script no longer knows which rows have more details. How do I get it working again?
I appreciate your help
(function()
{
var toggle=function(el, str)
{
if (!str)
{
el.style.display=(el.style.display==='') ? 'none':'';
}
else
{
el.style.display str;
}
},
getId=function(id)
{
return document.getElementById(id)
},
table=getId('data_table'),
backTo=getId('back_to_list'),
currentlyOpen,
getElementsByClassName=document.getElementsByClassName ? function (class_name, scope)
{
return (scope || document).getElementsByClassName(class_name);
}
: document.querySelectorAll ? function (class_name, scope)
{
return (scope || document).querySelectorAll("."+class_name);
}
: document.evaluate ? function (class_name, scope)
{
var n,
r=[],
x=document.evaluate("descendant::*[contains(concat(' ', @class, ' '), ' "+class_name+" ')]",
scope || document, null, 5, null);
while (n=x.iterateNext())
{
r.push(n);
}
return r;
}
: function (class_name, scope)
{
scope=scope || document;
var nL=scope.all || scope.getElementsByTagName("*"),
r=[];
for (var i=0, n; n=nL[i]; ++i)
{
if (n.className && (' '+n.className+' ').indexOf(' '+class_name+' ') != -1)
{
r.push(n);
}
}
return r;
};
if (!table || !backTo)
{
return;
}
var rows = getElementsByClassName('data', table);
if (!rows.length)
{
return;
}
for (var i=0, l=rows.length, row; i<l; ++i)
{
row = rows[i];
row.onclick=function()
{
var corresponding=this.id.slice(4);
currentlyOpen = getId(corresponding);
if (!currentlyOpen)
{
return false;
}
toggle(getId('data_table'));
toggle(getId('data_heading_left'));
toggle(getId('data_details'), 'block');
toggle(currentlyOpen, 'block');
return false;
}
}
backTo.onclick=function()
{
toggle(getId('data_table'));
toggle(getId('data_details'));
toggle(getId('data_heading_left'));
toggle(currentlyOpen);
return false;
}
})();
The behavior broke because the code was modified and the assignment operator was removed, resulting in a syntax error. To fix this, change
el.style.display str;
back to
el.style.display = str;
The declarations specified for .ismore are apparently being overridden because I said to update the other element’s selectors, to solve this we make the .ismore more specific like so ( in the css ):
[B]table#data_table td[/B].ismore {
inline-block and inline
An inline element is an element that appears inside of a block level and usually does not have dimensions defined:
<p><span>text</span></p>
The span inside of the paragraph is inline level, and for non-replaced elements ( <span>, <b> ) you cannot define dimensions ( though sometimes replaced elements can be given block level styles and adhere because they’re special - such as img, iframe, form controls and some other elements ). inline-block is a display mode which lets regular inline elements such as <span> be given dimensions, so you can define say a width of 50px and a height of 20px for that span and it appears inside of a paragraph along with other text, but is special. So by stating inline-block on a table you were basically telling it to pretend it was contained inside of a block level instead of its own box, limiting/restricting what declarations could be applied to it and certain behavior.
I’ll get to styling that back button or whatever is left over in a few, after these have been updated
I don’t understand a lot of development jargon as I’m essentially self-taught, and self-taught by hands-on experience rather than books, etc. I wasn’t sure what you meant by updating the selectors, but fixed now
Apparently there was a rendering engine inconsistency between Firefox and Safari/Opera and so the way I styled it messed the vertical aligning in Safari. This should make it consistent, assuming this is the only page containing the .heading_option element:
I decided to make one small change—to have the “Tank Details” heading update along with the details themselves. Unfortunately, I broke some of the code again. You can see that only the first tank will work. http://www.myhybridcar.com/fueleconomy/view_car.php?cid=119
Sorry for all the trouble, but would you mind please providing a fix? Thanks