When I try to run the following code, it claims the ptModCss function is undefined. However, when I remove the code declaring ptHeader, it works perfectly.
The error I get onLoad is:
Code:
missing ; before statement
[Break on this error] document.getElementById('pt-ht').innerHTML=a+'Left Sidebar');\n
And the error I get when I mouseOver where the function is supposed to execute:
Code:
ptModCss is not defined
onmouseover(mouseover clientX=0, clientY=0)
The code is as follows (Functions declared in the head of the document):
Code:
<script type="text/javascript">
function ptModCss(divId, action, class, old) {
if (action=='on') {
original=old;
document.getElementById(divId).className=class;
}
else if (action=='off') {
document.getElementById(divId).className=original;
}
else if (action=='edit') {
document.getElementById('pt-wrap').className='hidden';
document.getElementById('pt-edit').className='pt-edit';
ptHeader(divId);
}
else if (action=='placement') {
document.getElementById('pt-wrap').className='pt-wrap';
document.getElementById('pt-edit').className='hidden';
}
}
function ptHeader(divId) {
var a='Below are your ad settings for ';
if (divId=='sbl1' || divId=='sbl2' || divId=='sbl3' || divId=='sbl4') {
document.getElementById('pt-ht').innerHTML=a+'Left Sidebar');
}
else if (divId=='sbml1' || divId=='sbml2' || divId=='sbml3' || divId=='sbml4') {
document.getElementById('pt-ht').innerHTML=a+'Middle Left Sidebar';
}
else if (divId=='sbr1' || divId=='sbr2' || divId=='sbr3' || divId=='sbr4') {
document.getElementById('pt-ht').innerHTML=a+'Right Sidebar';
}
else if (divId=='sbmr1' || divId=='sbmr2' || divId=='sbmr3' || divId=='sbmr4') {
document.getElementById('pt-ht').innerHTML=a+'Middle Right Sidebar';
}
else if (divId=='sbmr1' || divId=='sbmr2' || divId=='sbmr3' || divId=='sbmr4') {
document.getElementById('pt-ht').innerHTML=a+'Middle Right Sidebar';
}
}
</script>
Code that calls the function:
Code:
<div class="sbl1" id="sbl1" onMouseOver="ptModCss('sbl1', 'on', 'hovered', 'sbl1');" onMouseOut="ptModCss('sbl1', 'off');" onClick="ptModCss('sbl1', 'edit');">
Any help is greatly appreciated, I'm having a lot of trouble with this, and I'm pulling hair out. I just wish I could find the problem, because I know it's gonna be something simple I can't see because I'm frustrated.