I have this JavaScript function which toggles the visibility of a certain div:
function showHideDiv(id){
var obj = document.getElementById(id);
if (obj.style.display=="none"){
obj.style.display='block';
} else if(obj.style.display=="block"){
obj.style.display='none';
}
}
I have a dynamic div that has the id="pm_message'.$row[0].'". I want to toggle the visibility of this div via the javascript function I mentioned above.
This is my link with the onclick-function:
echo '<h1><a onclick="showHideDiv('showHideDiv("message'.$row[0].'")" class="'.$link_class.'" href="'.$profile_url.'">'.$row['title'].'</a></h1>';
It doesn't work and I get this error message:
PHP Parse error: syntax error, unexpected '?'
– Danny Aug 02 '13 at 20:57