Simple Hide/Expand with Javascript

Posted by user478419 on Stack Overflow See other posts from Stack Overflow or by user478419
Published on 2011-01-01T16:00:17Z Indexed on 2011/01/01 17:54 UTC
Read the original article Hit count: 197

Filed under:
|
|
|

I have created a simple expand/hide test script:

<html>
<head>
<script type="type/javascript"><!--
function showHide(elementid){
    if (document.getElementById(elementid).style.display == 'none'){
        document.getElementById(elementid).style.display = '';
    } else {
        document.getElementById(elementid).style.display = 'none';
    }
}
//-->
</script>
</head>
<body>

<div><a href="javascript:showHide('div_1035677');">more...</a></div>

<div id="div_1035677" style="display:none">
HIDDEN CONTENT
</div>
</body>
</html>

I get an error message that I can't make any sense of (Object expected on line one). I don't see any errors in the above code. :-(

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about hide