Hi, I'm using a javascript to toggle content (show / hide) however for some reason I do not get users (all browsers) need to double click the link to actually toggle the content. JS: function toggleVisibility(controlId) { if (document.getElementById) { // DOM3 = IE5, NS6 var control = document.getElementById(controlId); if(control.style.display == "inline" || control.style.display == "") control.style.display = "none"; else control.style.display = "inline"; } else { if (document.layers) { // Netscape 4 if(document.controlId.display == "inline" || document.controlId.display == "") document.controlId.display = "none"; else document.controlId.display = "inline"; } else { // IE 4 if(document.all.controlId.style.display == "inline" || document.all.controlId.style.display == "") document.all.controlId.style.display = "none"; else document.all.controlId.style.display = "inline"; } } } Code (markup): Link: <a href="javascript:toggleVisibility('feedbackform')">Feedback form</a> <div id="feedbackform"> some form </div> css: #feedbackform{ display: none; } Code (markup): Can somebody explain me how to remove this behaviour and just make it 'one-click'? Thank you. Best regards,
Something like this <a href="javascript:void(0);" onclick="javascript:toggleVisibility('feedbackform')">Feedback form</a> <div id="feedbackform"> some form </div> Code (markup):
Hi, thanks but doesn't work.. I also tried making the link just <a href="#" onclick="....."> but doesn't work either.. I cant post link to the website here but it is unlocksamsungonline . eu / feedback.php B.r.
problem fixed: <div id="feedbackform" style="display:none" > and if(control.style.display == "") control.style.display = "none"; else control.style.display = ""; Best regards,